2 ms·
Well, in many typed languages, a lookup on a map will return an option type. If the key is in the map, it returns Some(value), but if it isn't, it returns None.
by wtetzner 10y ago
Well, in many typed languages, a lookup on a map will return an option type. If the key is in the map, it returns Some(value), but if it isn't, it returns None.
By encoding the possibility of a missing key in the return type, you force the programmer to deal with it in the program.
So in fact, having a good type system can help deal with those kinds of errors as well.