|
|
|
|
|
by rifung
3325 days ago
|
|
> Hey, at least they've got nullable types? That's a big win over Java right there. Can you elaborate what you mean by nullable types? You can set Object variables to null and with primitives you can do the same with their boxed alternatives (Integer) but I assume you mean something different? Like the lack of types which can't be null? I can see how that's useful |
|
In Kotlin/Swift by default all types do not include "bottom" or "null". You add a ? to the type to indicate you may use that value, then the compiler will validate you're checking for the existence of null before you use the type.
It's one approach... I prefer the Haskell approach with a simple Maybe/Option type.