Hacker News new | ask | show | jobs
by nostrademons 2377 days ago
Most languages with Either/Result have some form of monadic composition and type inference. This lets you basically ignore the error condition until you get to a level where it's appropriate to handle it, and the compiler will check the error types for consistency without you having to specify anything explicitly.

Either/Result has often been found to be untenable without these mechanisms, as well. Rust first added the try! macro and then the ? operator because it was so tedious to deal with raw Results otherwise.

1 comments

This works for checked exceptions as well, just bubble it up to a place where you want to handle them by stating that your function might throw those exceptions.