Rust Result Error Handling
The cluster focuses on discussions advocating for Rust's Result type (and equivalents like Haskell's Either or Swift's Result) as superior for error handling compared to exceptions, tuples, or other methods, emphasizing compiler-enforced handling and practical examples.
Activity Over Time
Top Contributors
Keywords
Sample Comments
It sounds like you're precisely describing Rust's Result type. [0][0] https://doc.rust-lang.org/std/result/
Rust's Result or Haskell's Either are wholely better for this purpose.
Rusts good support for option and result types might help here.
What's bad about locking the programmer into using Result or Option? These are enough for many common use cases, and anyway, you're free to use something else and unwrap it manually.
Rust does this too with `Result::ok`
Do you mean like Swift? (which also has a Result type)https://docs.swift.org/swift-book/LanguageGuide/ErrorHandlin...
I would also love Result in as a return type in place of (err, myThing)
I like Rust's approach of using `Result` enum
Check out how rust handles error composition using its Result type
Rust leaves it unrestricted. As does Haskell (although I am lying a little most just choose to use Either for Result)Rust actually gets some use out of it, for instance returning an alternative value instead of handling it as a pure failure.