4 ms·
This sounds clever at the expense of readability. Creating an explicit fallback mechanism for a Result would imo be preferable.
by im3w1l 7y ago
This sounds clever at the expense of readability. Creating an explicit fallback mechanism for a Result would imo be preferable.
- pwm 7y agoIt's not clever for its own sake. Haskell is rooted in math and Either is logical disjunction. Its semantics is precisely that. Error handling is a specific use-case that can be implemented with Either. Rust as a language is more pragmatic. In real-world industrial code the concept of Either is predominantly used for error handling and thus Rust named their data constructors aptly.