3 ms·
Having to throw ?s and unwraps on what amounts to essentially every single function call--as if you think your function can't fail you probably didn't think thr
by saurik 6y ago
Having to throw ?s and unwraps on what amounts to essentially every single function call--as if you think your function can't fail you probably didn't think through what it does very well--is kind of ridiculous, though: good systems avoid error "handling" (so you never look at errors) and centralize error management and recovery (so you want error routing, which exceptions can do). Even Erlang and Haskell (yes, in addition to monads) have exceptions, and languages with true "monadic" error handling (which some claim Rust has, but it doesn't) manage to hide it all behind their monad application syntax. Rust has taken a "worst of all worlds" approach here, mixing all of poor performance, poor ergonomics, and poor functionality together to get their current error handling solution :(.
- dralley 6y agoThat is very much an opinion. It's very useful to know exactly which lines might be throwing an error. And I don't agree that "essentially every single function call" needs a ? or an unwrap(), that has not been my experience at all.