Re:Why nullable types?
by Nullabillity on Tuesday December 08, 2020 @05:14AM
(#25343633)
Language culture matters. Scala has both `Option` and `null`, but there's a strong culture of "`null` is only for Java interop", so you very rarely see a `null` in the wild from libraries, or wonder whether it'd be valid to pass it in.
[ Parent
| on HN ]
Interestingly, Scala 3 is adding union types as well as explicit `null`s:
https://dotty.epfl.ch/docs/reference/other-new-features/expl...
I think that the expectation is that idiomatic Scala code will mostly still use `Option`, while `null` will be used for interoperability with Java, JavaScript or Scala libraries that happen to use `null`.
In any case, I am very much looking forward to these additions.
Re:Why nullable types?
by matt_kantor on Tuesday December 08, 2020 @07:02PM
(#25353434)
Your username is so incredibly relevant here that I had to check if this was a novelty account.