News for hackers. Stuff that matters.
Re:Error Handling in Zig by LelouBil on Sunday August 06, 2023 @12:30PM (#37023670)
Yeah, exceptions and try/catch blocks have way worse ergonomics that Result<Err,Ok>.
Re:Error Handling in Zig by pjmlp on Sunday August 06, 2023 @01:24PM (#37024384)
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?

Re:Error Handling in Zig by pjmlp on Monday August 07, 2023 @01:31AM (#37030518)
Or maybe, because the feature wasn't properly developed, and needs community fixes to make it usable.
Re:Error Handling in Zig by LelouBil on Monday August 07, 2023 @07:01PM (#37042124)
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.