Yeah, exceptions and try/catch blocks have way worse ergonomics that Result<Err,Ok>.
Then why does Rust need third party crates for sane ergonomics?
Re:Error Handling in Zig
by veber-alex on Sunday August 06, 2023 @03:19PM
(#37025549)
Because there isn't a one size fits all solution to error handling?
Because before anyhow/thiserror became popular there were 5 other popular crates for handling errors and if Rust added one of those to std we would be stuck with a subpar solution forever?
Because cargo is so easy to use that your preferred error handling solution is one `cargo add` command away?
Because for simple cases the tools the standard library offers are good enough?
Or maybe, because the feature wasn't properly developed, and needs community fixes to make it usable.
I'm not really talking about the "errors" ergonomics, but more about error handling.
The methods like .map .map_err .and_then I feel are way easier to reason about and also often shorter that what would happen in a control flow breaking catch block.
The problem of java's checked exceptions is not that being explicit is bad, it's that java's implementation is terrible.