Re:The Logical Disaster of Null
by chaosite on Thursday May 10, 2018 @06:39AM
(#17037703)
Well, not really. What Kotlin has is exactly an Optional type. It's just a different syntax for it.
[ Parent
| on HN ]
There's one difference between nullable/non-nullable types and Optional type, which is nesting, right?
I'd assume that while Kotlin's String? is equivalent to Optional<String>, Kotlin has no equivalent to Optional<Optional<String>>.
Which, personally, I think I'd prefer Kotlin's approach, because that means you can do `maybeString = "exists"`, which is more readable than `maybeString = Optional::Exists("exists")`