News for hackers. Stuff that matters.
Re:Using unwrap() in Rust is okay by saghm on Monday August 08, 2022 @01:32PM (#32388485)
> The criteria I tend to prefer is "expected" versus "unexpected" errors

The way I've often heard this phrased is "exceptions are for exceptional behavior", and it's always rubbed me the wrong way a bit (although maybe this is partially just because I don't think wordplay is a sufficient argument to do something; I've made similar arguments in the past to friends who sung the praises of "no-shave November" and "thirsty Thursdays"). From digging a bit deeper when I've heard this opinion espoused, it seems like it mostly boils down to the fact that exceptions tend not to be as efficient as happy-path code, so using them for circumstances that are too common is not going to lead to good performance. I guess I don't really find this a subtle enough concept to warrant needing to introduce another abstraction layer into the discussion, especially one that's much vaguer like "is this behavior expected?" If there's a performance concern, I think it's much better addressed directly rather than shifting the discussion to a proxy.

Re:Using unwrap() in Rust is okay by spion on Monday August 08, 2022 @03:41PM (#32390078)
In languages with exceptions there typically isn't much of a distinction between expected and unexpected errors.