3 ms·
Result is essentially trying to only be an error-handling technique, its two variants are Ok and Err (less generic than Left/Right). I believe the 'Result' name
by dbaupp 12y ago
Result is essentially trying to only be an error-handling technique, its two variants are Ok and Err (less generic than Left/Right). I believe the 'Result' name actually comes from OCaml.
Rust used also to have an isomorphic type called Either, but error handling was found to be by far the most common use of these two types, so it was decided to standardise on a single one with obvious variant names (i.e. it's clear with Ok/Err which one is the error and which one is the real value, while Either requires getting the Left/Right convention right).
- rbonvall 12y agoI remember having read that the convention was using Right when the value was right and Left for the error (the error that's left, I imagine).