Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Non-null types and non-null by default (NNBD) #30

Closed
chalin opened this issue May 22, 2015 · 11 comments
Closed

Non-null types and non-null by default (NNBD) #30

chalin opened this issue May 22, 2015 · 11 comments

Comments

@chalin
Copy link
Contributor

chalin commented May 22, 2015

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.

@hexpunk
Copy link

hexpunk commented Jan 18, 2018

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.

@FranklinYu
Copy link

TypeScript also has this (although not enabled by default).

@leafpetersen
Copy link

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.

@insidewhy
Copy link

insidewhy commented Mar 18, 2018

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.

@touseefbsb
Copy link

progress seems to be stopped on this :/

@harindaka
Copy link

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?

@munificent
Copy link
Contributor

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.

@touseefbsb
Copy link

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.

@munificent
Copy link
Contributor

I hope dart catches on to them ASAP.

Me too, my friend.

@mit-mit
Copy link
Contributor

mit-mit commented Feb 4, 2019

Editorial note: this is a historical issue; the current working proposal is dart-lang/language#110

@munificent
Copy link
Contributor

Edited the original description to point to the new tracking issue and closed this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

9 participants