3 ms·
Rust's Result type and `?` operator makes error handling kinda fun. Every language should strive to be this clean.
by lostdog 5y ago
Rust's Result type and `?` operator makes error handling kinda fun. Every language should strive to be this clean.
- elcritch 5y agoNim’s got an Option type, though it’s not as popular as exceptions. There’s also third party option libraries that provide ‘?’ like features.
- lostdog 5y agoHaving a single Result type as standard has a huge benefit. You can do error handling for every library you use in exactly the same way. You also get decent stack traces because the runtime can reason about a single error type. Unified error handling is, IMO, necessary for making a language a pleasant experience.