32 ms·
IOW the most ergonomic error handling is a monad, and I agree.
by PartiallyTyped 4y ago
IOW the most ergonomic error handling is a monad, and I agree.
- int_19h 4y agoAnd exceptions can be considered a syntactic sugar on top of just such a monad. It's just that many believe it's too much sugar to be good for you, particularly the implicit rebind part.
- the_gipsy 4y agoToo much sugar can be bad, for flavor and health.
- eddd-ddde 4y agoThere's this language called zig, and there errors are represented as union values and have this kind of syntax to work with but way more explicit, really like the idea of how they do it.
- PartiallyTyped 4y agoNot exactly. You may catch exceptions in between the computations, whereas with monads you have to unpack and match the error. You can replicate the monad behaviour by catching the exceptions at the top level. I find that this approach is generally cleaner than intermediate exceptions but is more restrictive.
- int_19h 4y agoThat's what I meant by "implicit rebind". But the fact that it's implicit for every expression doesn't make it any less of a monad.
- PartiallyTyped 4y agoI see, thanks for the clarification.