3 ms·
In theory: explicit error handling. An error should be taken care of immediately, or propagated with some additional context. Returning the error instead of th
by linkdd 5y ago
In theory: explicit error handling.
An error should be taken care of immediately, or propagated with some additional context. Returning the error instead of throw/catch makes this explicit and forces the developer to think about it.
In practice: a lot of boilerplate code.
Rust does this better with the Result type and the ? operator.
- eyelidlessness 5y agoFrom a pragmatic perspective, the theoretical advantage is real (typed exceptions are better than not having them, just as explicit nullables are better than implicit). Theoretically Result and Option are just recognized names, which I don’t mean to discount but they’re effectively union types with pattern recognition privileges.