|
|
|
|
|
by cromwellian
4224 days ago
|
|
The error handling stuff more than lack of generics is my single biggest beef with the language. It is basically C-style error handling from the 80s all over again, only you return error codes as a separate multi-return value. The Maybe monad style is so much cleaner, it also allows Elvis operator-like changing, e.g. foo().getOrElse(blah).getOrElse(baz) |
|
E.g., think of each of those method calls as being a call to some external system (filesystem, memcache, database, etc) that might fail, even if the code's correct. Throwing an exception is usually a pretty bad strategy for those cases if you want to able to sort out what went wrong later.