News for hackers. Stuff that matters.
Re:A new approach to error handling by kelnos on Tuesday July 30, 2024 @01:41PM (#41111979)
This is decent, but I don't like that the compiler only warns if you don't handle things properly. This should be a hard compiler error.

But overall I don't agree with the premise that explicit error handling is difficult for new developers, and is better suited for seasoned developers. Handling errors is a part of programming, period, and we do new developers a disservice by trying to hide that fact.

I think Rust-style error handling is fine, where you can handle them at the call site, or use `?` to propagate to the caller, and it's good that propagation requires that the current function returns a Result with a compatible Err type. (I do wish not handling a Result was a hard error, and not just a warning via `must_use`.)

Re:A new approach to error handling by sans-seraph on Tuesday July 30, 2024 @03:18PM (#41113103)
> I do wish not handling a Result was a hard error, and not just a warning via `must_use`

It is possible to turn any Rust warning into an error with the use of the `deny` attribute. In addition it is now possible to configure the behavior of lints in the `lints` section of Cargo.toml.

Re:A new approach to error handling by zupa-hu on Tuesday July 30, 2024 @03:54PM (#41113465)
Author here, thanks for the comment, it is indeed a hard compiler error not a warning. Bad wording.

It is a fair point too about new developers / seasoned developers. Maybe citizen developers is a better phrase? I've encountered many non-professional developers who just hack together things and really couldn't stand verbose error handling. And for what they do, frankly, I don't blame them. I'm also fine writing bash scripts without a decent type system.