Null Safety and Option Types¶
Representing "absence of value" as a distinct type (rather than a special value like null) forces explicit handling of the missing case, eliminating null pointer exceptions by construction.
Tension Addressed¶
Safety vs. Flexibility; Expressiveness vs. Simplicity
Recognizable As¶
Option/Maybe/Optional types; required unwrapping before use; compiler errors when null case not handled; null-safe navigation operators as syntax sugar
Canonical Sources¶
Hoare, "Null References: The Billion Dollar Mistake" (2009 talk); Pierce, Types and Programming Languages (2002)
Transfers To¶
API design (explicit optional parameters), data modeling (nullable fields as explicit optionality), error handling (Result types as success-or-failure)
Tony Hoare called null references his "billion dollar mistake." Option types demonstrate how encoding invariants in the type system can eliminate entire categories of runtime errors. The pattern extends to any domain where "absence" needs explicit handling rather than implicit special values.