-
Notifications
You must be signed in to change notification settings - Fork 9
Non-null types and non-null by default (NNBD) #30
Comments
It's been two and a half years since this was introduced. Can we get an overall status report? Is this a feature that the Dart core team is committed to? I ask because having the type system of a language deal with nulls so that developers don't have to do null checks everywhere or risk null pointer exceptions from practically anywhere is kind of a killer feature for me. Kotlin has non-nullable by default. Clojure has nil-punning. Haskell and family side-steps this using Maybe/Nothing monads. This is, believe it or not, my number one biggest ask for Dart. |
TypeScript also has this (although not enabled by default). |
We're very focused on getting Dart 2 out the door right now. Once that's out (very soon), I'm hoping that we can put effort into this. |
If this feature comes to Dart, and I really hope it does, it should really be done in concert with union types (https://github.com/dart-lang/sdk/issues/4938). That's the only feature Dart is lacking that I think is even more important than this one. Each feature would really compliment the other. |
progress seems to be stopped on this :/ |
Wow I just started on Dart and was surprised that you can assign null to ints. This is so not intuitive. Nullable value types should be opt in. i.e. int? in C# It might be too late to change the current implementation however can something like int! be done to explicitly disallow null assignments? |
We've spent the past couple of years significantly overhauling the type system to add generic methods and make it sound. Those are both massive breaking changes and we weren't able to get non-nullable types in at the same time. We haven't given up hope on them, but they didn't make it into Dart 2 unfortunately. |
dart is a very good language but considering it is a web language and also now a major part of flutter, so for its success it is crucial that it tries its best to compete with c#, kotlin and swift, and those 3 languages are brilliant and powerful, I hope dart catches on to them ASAP. |
Me too, my friend. |
Editorial note: this is a historical issue; the current working proposal is dart-lang/language#110 |
Edited the original description to point to the new tracking issue and closed this. |
Edit: The language team is now working on adding non-nullable types to Dart: dart-lang/language#110. Much of that work is inspired by and directly uses ideas in this proposal (including the name!). However, we aren't using this issue to track that work, so I'm closing it out. dart-lang/language#110 is where the action is now.
The text was updated successfully, but these errors were encountered: