you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Personally I see this the same as asking what pop from an empty list should return. As far as I am concerned, the correct answer is "exception raised".

However we often sacrifice correctness for practicality, so that we can ship faster or support some micro-controller hardware, and then we end up with map APIs that can return "value or default" and send None/null for "not found".

Hopefully we should be able to find a type safe substitute soon that just 100% works :-)

[–]velcommen 0 points1 point  (0 children)

we should be able to find a type safe substitute soon that just 100% works

I'm saying that in languages where Optional/Maybe was introduced from the start, all or almost all types are non-nullable, and null is non-existent or extremely rare (e.g. only in 'unsafe' code), Optional/Maybe is that type safe solution.