Re:Why Go Gets Exceptions Right
by kruffin on Friday September 14, 2012 @10:57AM
(#4521927)
If an assumption can be made that you won't put null values into the map then it can be rewritten where it doesn't need to do the check described above:
Any class correctly implementing Map in Java won't throw an exception if there is no value for an input key (http://docs.oracle.com/javase/6/docs/api/java/util/Map.html#...) and some don't allow you to put null values in to begin with (http://docs.oracle.com/javase/6/docs/api/java/util/Hashtable...).
[ Parent
| on HN ]
I think one of the points of the OP's article is that in Go you don't have to code like you've done here, where a single return value means one of two things (in your example: value in the map, or special reserved value that indicates the key wasn't found in the map). Go is cleaner, even if it's just a small improvement.