9 ms·
How is option different from proper nullability in the type system? In every case I've seen an option type be used, it was always a less efficient way of approx
by mike_hearn 11y ago
How is option different from proper nullability in the type system? In every case I've seen an option type be used, it was always a less efficient way of approximating how Kotlin does it.
Kotlin has deconstruction:
val (a,b,c) = myDataObject
Their documentation did indeed commit this sin when I first started using Kotlin last year. It's been cleaned up considerably and this is no longer an issue (except, I think, for the mysterious modules which appear to be an IDE specific concept).
- CookieCutter2 11y ago1. Option solves a long list of programming problems (mostly around things being there or not, but others as well) while non-nullable types only solve NPEs. 2. Sorry, wording is vaque, often deconstruction is val MyValueObject(a,b,c) = myObject