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.

📉 Falling 0.4x Programming Languages
2,343
Comments
19
Years Active
5
Top Authors
#6213
Topic ID

Activity Over Time

2008
2
2009
5
2010
19
2011
29
2012
31
2013
69
2014
114
2015
199
2016
144
2017
166
2018
171
2019
204
2020
196
2021
232
2022
198
2023
217
2024
167
2025
170
2026
10

Keywords

IckWtfer JS FirstOrDefault DoStuff log.warn i.e d.get TypeError wikipedia.org optional null foo nullable option wtf map nil return value

Sample Comments

shepherdjerred • Aug 2, 2024 • View on HN

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.

vbezhenar • Oct 26, 2015 • View on HN

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.

Peaker • Sep 20, 2015 • View on HN

An Optional type is more clumsy than null checks and null returns sprinkled everywhere??

monksy • Aug 9, 2023 • View on HN

This feels like Option/Optional all over again.

shepherdjerred • Jun 19, 2022 • View on HN

It can if you choose to return Optionals instead of nulls.

detaro • Feb 3, 2020 • View on HN

What "functional programming features" does one need for useful optional types?

spullara • Sep 23, 2024 • View on HN

yes and it is called Optional (rather than Maybe)

randomopining • Apr 28, 2024 • View on HN

Doesn't an Optional basically cover this case

grenoire • Apr 29, 2022 • View on HN

After starting using Option, no implementation of null is 'brilliant' any more. Not that any one of them ever was.

malcolmgreaves • May 31, 2018 • View on HN

Learn about the Option type: https://en.wikipedia.org/wiki/Option_type