News for hackers. Stuff that matters.
Re:Where Everything Went Wrong: Error Handling and Error Mes... by Kaze404 on Friday February 19, 2021 @06:26AM (#26191944)
Isn't that what the Result type on Rust is? Sure, one of the branches is still called Error but it's just a plain language construct (a sum type you can write yourself).
Re:Where Everything Went Wrong: Error Handling and Error Mes... by creata on Friday February 19, 2021 @06:36AM (#26192027)
Yep, although I guess the Try trait[0] and the corresponding ? operator count as a special error handling language construct.

[0]: https://doc.rust-lang.org/std/ops/trait.Try.html

Re:Where Everything Went Wrong: Error Handling and Error Mes... by ymbeld on Friday February 19, 2021 @12:35PM (#26195563)
The Result type is specifically designed to store value-or-error. One may use it diffently but that’s what it’s made for.

The library designers had a choice between making a generic this-or-that type or a value-or-error type and they chose the latter because they thought that that would be the common this-or-that use-case.

Even Haskell’s more generic-sounding “Either” type is made for the same purpose: the “right” (as in correct) variant is the value while the left side is the error, by convention.

Re:Where Everything Went Wrong: Error Handling and Error Mes... by zanellato19 on Sunday February 21, 2021 @09:17PM (#26220000)
While Result is designed for that, it was built with an Enum (see here: https://doc.rust-lang.org/src/core/result.rs.html#241-251)

So you can also build an enum that doesn't have any explicit mention of which is the right path

Re:Where Everything Went Wrong: Error Handling and Error Mes... by Kaze404 on Friday February 19, 2021 @01:06PM (#26195948)
I don't understand what the problem is, in that case. Is it just the fact that it's called an Error instead of something more generic? Not trying to sound dismissive, just trying to understand if there's something I'm missing.
Re:Where Everything Went Wrong: Error Handling and Error Mes... by ymbeld on Friday February 19, 2021 @01:20PM (#26196129)
The problem? You would have to ask the poster that you initially replied to.
Re:Where Everything Went Wrong: Error Handling and Error Mes... by Kaze404 on Friday February 19, 2021 @01:38PM (#26196344)
Fair enough :)