3 ms·
Returning an error type, and, in the caller, propagating that return type further up, is isomorphic to exceptions, except it's a lot more busywork, a lot more c
by barrkel 10y ago
Returning an error type, and, in the caller, propagating that return type further up, is isomorphic to exceptions, except it's a lot more busywork, a lot more code bloat, and a lot easier to get wrong.
- perspectivep 10y agoAnd you have to remember to log the error at every level of the stack, otherwise you're left with an error code that has no context.
- yoklov 10y agoIt's also encoded in the return type of the function, so you get static type checking -- a property not present for exceptions.
- barrkel 10y agoYou say that like it's desirable. I think Java's experience of checked exceptions shows that it's of very dubious benefit.