4 ms·
There are many things you can express with ADTs that you can't express with nullable types, and once you have those, Option is simpler than extending the type s
by aninhumer 10y ago
There are many things you can express with ADTs that you can't express with nullable types, and once you have those, Option is simpler than extending the type system.
EDIT: Another thing you can do with Option is define generic abstractions that work on it and other types, like map/flatMap. This in turn means you can write generic functions over anything that can be flatMapped which work automatically for Options. (I don't know if there's anything equivalent in Kotlin though?)