3 ms·
Scala encourages people to not use nulls everywhere, so adding syntactic sugar for a special case, which is not even idiomatic Scala doesn't sound like a good i
by justthistime_ 12y ago
Scala encourages people to not use nulls everywhere, so adding syntactic sugar for a special case, which is not even idiomatic Scala doesn't sound like a good idea.
Option is not a "replacement" for null. Sometimes another type is more appropriate to replace a usage of a null in Java/C#, so making Option special would be counter-productive.
- acjohnson55 12y agoI wouldn't use null anywhere in my Scala code, unless I had to in order to interface with a Java library. I'm talking about sugar for working with Option.
- justthistime_ 12y agoWhere would this sugar stop? At Either? At Try? At Validation? The problem is that if you introduce the sugar only for Option, users will tend to use Option even in cases where other type constructors would be more appropriate.