4 ms·
4) Good luck getting a stack trace. That's a great point. At the end of the day, Either and (checked) exceptions are equivalent from a semantic point of view,
by gpderetta 10y ago
4) Good luck getting a stack trace.
That's a great point. At the end of the day, Either and (checked) exceptions are equivalent from a semantic point of view, but having exceptions being an explicit part of the language means much better support for tooling and debugging.
- pacala 10y agoNothing prevents the system to add a stack trace on the Error branch of an Either. It's just that some evaluation strategies [lazy] that are usually associated with functionally programming [Haskell] provide unusual reduction traces. An eagerly evaluated expression would add the usual stack traces.
- gpderetta 10y agoIt is not just stack traces. If an exception is not handled, the debugger will break at the frame that trowing the exception (at leat on sane implementations that do two phase unwind), while with either (and error codes) all state useful for debugging will have been destroyed.