Optional Types Debate
Discussions center on the usefulness, ergonomics, and best practices of Optional/Option types versus null for handling absent values in programming languages like Java, Rust, and Haskell. Debates include their syntax, compiler support, functional methods like map/flatMap, and comparisons to traditional null checks.
Activity Over Time
Top Contributors
Keywords
Sample Comments
How is Optional useless? I've found it to be very ergonomic, though I do wish there was more support for it in the standard library.
Why it's bad? If I'm sure that this optional contains value, I don't see why it's bad. May be I checked this value presence few lines above.
An Optional type is more clumsy than null checks and null returns sprinkled everywhere??
This feels like Option/Optional all over again.
It can if you choose to return Optionals instead of nulls.
What "functional programming features" does one need for useful optional types?
yes and it is called Optional (rather than Maybe)
Doesn't an Optional basically cover this case
After starting using Option, no implementation of null is 'brilliant' any more. Not that any one of them ever was.
Learn about the Option type: https://en.wikipedia.org/wiki/Option_type