Rechercher dans ce blog

Thursday, June 11, 2020

Google Dart gains sound null safety - InfoWorld

Google’s Dart language is being fitted with sound null safety, helping developers avoid a class of bugs that can be hard to spot. “Sound” null safety means that Dart is 100% sure that non-nullable variables cannot be null. 

Now in preview, Dart’s null safety also improves performance, members of the Dart team said on June 10. The new feature is largest addition to the language since the introduction of Dart 2, launched in August 2018. Null safety is available for tryout in a version of DartPad, and due in a production-ready Dart release by the end of 2020. 

Dart is a type-safe language, meaning the compiler can guarantee the type of a variable. But type safety itself does not guarantee that a variable is not null. Null errors are common, having led to many issues in Dart code and many commits trying to fix those issues. Null safety lets developers reason about code with more confidence, without having to worry about runtime null dereferencing errors. Developers instead receive static errors as they code.

Soundness in null safety enables Dart programs to be faster and smaller. Dart analyzes code, determines that a variable is non-nullable, and ensures tat it is always non-nullable. The ahead-of-time compiler can produce smaller and faster code because it does not need to add checks for nulls when it knows a variable is not null.

The Dart team is endeavoring to make null safety as easy to use as possible. Also, null safety is backward compatible and not a breaking change. It will be an optional feature, allowing developers to adopt it whenever they’re ready. Dart core libraries have been migrated to use null safety.

Design principles of Dart’s sound null safety include:

  • Non-nullable by default. Developers must explicitly note that a variable can be null, or it will be considered non-nullable. Non-null is common in APIs.
  • Incrementally adoptable, with tools to be provided to help with migration.
  • Fully sound, with projects reaping the benefits of soundness once migrated.

Let's block ads! (Why?)



"sound" - Google News
June 12, 2020 at 04:51AM
https://ift.tt/2Yrvm6X

Google Dart gains sound null safety - InfoWorld
"sound" - Google News
https://ift.tt/2MmdHZm
Shoes Man Tutorial
Pos News Update
Meme Update
Korean Entertainment News
Japan News Update

No comments:

Post a Comment

Search

Featured Post

Mysterious noise irking Tampa residents may be fish mating loudly: 'Pretty uncommon phenomenon' - New York Post

Residents of Tampa, Florida have reported hearing strange noises coming from the bay for years, and now scientists believe it may be fish ...

Postingan Populer