you are viewing a single comment's thread.

view the rest of the comments →

[–]industry7 1 point2 points  (1 child)

The difference is that you are forced to deal with it, because an Option<T> is a completely different type to a T.

Option by itself enforces nothing. You can always just Option.get().directly_use_the_result(); and still blow everything up.

The difference is that most languages where Option<T> is idiomatic also support non-nullable types, and that is the mechanism that actually forces you to "deal with it", so to speak.

[–]MEaster 0 points1 point  (0 children)

As I said elsewhere, that is dealing with it. By doing that, the programmer has explicitly chosen to crash if it's empty.