4 ms·
And it's not like one is stuck with Option either. I think the ability to choose which abstraction is the best for a specific use case (Option, Either, Validati
by frowaway001 13y ago
And it's not like one is stuck with Option either.
I think the ability to choose which abstraction is the best for a specific use case (Option, Either, Validation, Future, etc.) is the major benefit over languages which just bake the handling into the language.
Sure, those languages could just ship with additional classes which did that, but the problem is that they wouldn't be able to use the syntax sugar which is built-in for the special case of nulls as well as other language constructs like Scala's for-comprehensions which work for all types of a certain shape, not a single, built-in special-cased item.
- gavinking 13y agoAgain, nullable types are not "baked into" the language. They are syntax sugar for a union type. Also, Ceylon doesn't need Either, since that is just a workaround for not having union types. Seriously, union and intersection types are _really_ fundamental notions in set/type theory, and having them as basic constructs of the language makes the language _much_ more expressive. I seriously urge you to try it out. You'll love them, I guarantee it.
- frowaway001 13y ago> Again, nullable types are not "baked into" the language. They are syntax sugar for a union type. So I can have my own type standing in for the ? instead of Null? String? // Option[String] ... String? // Validation[String]
- RivieraKid 13y ago"String?" is equivalent to "String|Null". Only the question mark syntax sugar is baked in.