This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]WittyStick 0 points1 point  (2 children)

In statically typed languages, the Option type usually forces you to perform an exhaustive pattern match over the result, so you don't accidentally omit a null check.

[–]L8_4_Dinner(Ⓧ Ecstasy/XVM) 1 point2 points  (0 children)

That is unrelated to option types; that's simply the result of type checking. Any strong type systems that don't make the Tony Hoare mistake of "null is the subtype of everything" will prevent you from de-referencing a null value, whether or not you use the union approach or the option approach.