Re:Dark side of ergonomics in Rust
by xamuel on Saturday April 14, 2018 @10:52AM
(#16837538)
People misuse exceptions. They use them as control-flow, like another form of "if...then", and as you point out, they're terrible for that.
The proper way to use exceptions is when you want behavior that bubbles up. So if you do x=f(g(h(x))) and h(x) fails because the user didn't configure something, you only need the config-checking logic in h, not in g or f. This use-case is quite rare though, and overall not worth the extra language complexity.
The proper way to use exceptions is when you want behavior that bubbles up. So if you do x=f(g(h(x))) and h(x) fails because the user didn't configure something, you only need the config-checking logic in h, not in g or f. This use-case is quite rare though, and overall not worth the extra language complexity.