3 ms·
> You do realise an enum can have any number of variants, not just 2? Yes, that's what makes it more generic than Result. Indeed that's the only practical diff
by ChrisSD 7y ago
> You do realise an enum can have any number of variants, not just 2?
Yes, that's what makes it more generic than Result. Indeed that's the only practical difference except for a few helper functions and a #[must_use] (which only makes sense for Result, not for a more general Either type).
>> Result has semantic meaning that's lost with Either.
>Which is what?
Seriously? Error checking! That's the whole point of it. One side has meaning over the other; it has weight. The "left" is the result you want. The "right" is when something gone wrong.
- leshow 7y ago> Yes, that's what makes it more generic than Result. Indeed that's the only practical difference except for a few helper functions and a #[must_use] I think you have some fundamental misconceptions about sum types. Note that enums also don't even need to have any variants. enum Never {} Either way, this discussion is no longer fruitful. I encourage you to read about sum & product types.