3 ms·
This has the same properties as B in his examples though - one can simply fail to catch the exception and the same problems arise. I actually much prefer the B
by sparkie 12y ago
This has the same properties as B in his examples though - one can simply fail to catch the exception and the same problems arise. I actually much prefer the B solution (or a variation, where instead of returning error codes, you pass in an exception handler function), as opposed to exceptions which are "hidden" from the API and rely on users to read documentation (hint: most people don't, until they find out the hard way).
- aurelianito 12y agoIt is different. An excepction decouples the place where errors must be handled from where the required object will be used. A closer example would be if the function received a function pointer or, even better, a continuation to be invoked if an error ocurrs.