4 ms·
If those functions are interchangeable then you potentially have to deal with exception control flow on every line, or even within a single line. It makes it ve
by lmm 7y ago
If those functions are interchangeable then you potentially have to deal with exception control flow on every line, or even within a single line. It makes it very hard to reason about all possible paths through a given function and do things like safe resource management (e.g. you always have to handle the possibility of further exceptions in your exception-handling code path).
For system failures it's ok because the only handling you're going to do is retry at high level (and so even languages with an Either-oriented style tend to have some form of "panics" or exceptions for that kind of failure). But it can be a real problem when that also happens for "normal failure" paths like bad user input where you want to actually have business logic that handles and perhaps recovers from the failure.
- deleted 7y ago[deleted]
- cousin_it 7y agoI think you can often avoid reasoning about all possible paths, by having one try-finally block per each resource to be freed.