4 ms·
While I love null safety, It's hardly a given. For Dart in particular, it sounds like there was a serious discussion about the choice, and it could have gone th
by johnthuss 4y ago
While I love null safety, It's hardly a given. For Dart in particular, it sounds like there was a serious discussion about the choice, and it could have gone the other way.
(edit: removed incorrect statement about Python's type safety)
- masklinn 4y ago> languages like Python that don't provide any static type safety https://docs.python.org/3/library/typing.html https://docs.python.org/3/library/typing.html https://github.com/python/mypy https://github.com/python/mypy > let alone null safety https://docs.python.org/3/library/typing.html#typing.Optional https://docs.python.org/3/library/typing.html#typing.Optiona...
- The_Colonel 4y agoFWIW my (1 year old) experience with mypy was very poor. Stuff breaking between releases, wrong resolution, bugs. It kinda felt like a 3rd party fun project, not an official high quality solution. The fact that the source can contain completely wrong declarations and Python will happily run it anyway felt really bad. It's kinda like JavaDoc rather than a classic type system.
- IshKebab 4y agoLanguages like Java, Go and C were all designed before it became obvious that `Option<>` or `?` were obviously the right thing to do. You can live with it, but most language eventually add some way to deal with it. Java has @NonNull. Javascript and Python both have static type annotations that are non-nullable. Even C++ has some attempt at it (std::option<>). The only one I know of that hasn't bothered trying is Go.
- mrkeen 4y agoBut the absence of nulls is the feature, not the presence of Option.
- the_gipsy 4y agoZero-values and pointers-as-options is not even half as good as Option<T>. At best, it was easy to implement, and convenient to use, until you actually had to run the program.
- Quekid5 4y agoGo absolutely wasn't. It has been obvious since ML and Haskell.
- pjmlp 4y agoC yes, Standard ML was already a thing when Java and Go came to be, and even plenty of other ML derived languages.
- munificent 4y ago> For Dart in particular, it sounds like there was a serious discussion about the choice Yes, we debated it for years. Literally the day we launched, a user filed an issue requesting support for null safety: https://github.com/dart-lang/sdk/issues/22 https://github.com/dart-lang/sdk/issues/22 For most of Dart's history, that was the #1 upvoted issue on the issue tracker. Back in 2011 before I worked directly the language, I proposed null safety: http://journal.stuffwithstuff.com/2011/10/29/a-proposal-for-null-safety-in-dart/ http://journal.stuffwithstuff.com/2011/10/29/a-proposal-for-... I'm immensely glad we finally did it, even though the migration has been a ton of work.