Re:HTTP/3: Everything you need to know about the next-genera...
by ciupicri on Saturday February 12, 2022 @09:08PM
(#30318433)
What's so great about `if err != nil` ?
[ Parent
| on HN ]
Re:HTTP/3: Everything you need to know about the next-genera...
by linkdd on Saturday February 12, 2022 @09:12PM
(#30318459)
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.
Re:HTTP/3: Everything you need to know about the next-genera...
by eyelidlessness on Saturday February 12, 2022 @09:38PM
(#30318587)
From 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.
Re:HTTP/3: Everything you need to know about the next-genera...
by dmitshur on Saturday February 12, 2022 @10:04PM
(#30318727)
I like the “opportunity for correction” and “code proportionality” points brought up in https://medium.com/@shazow/code-boilerplate-is-it-always-bad....