4 ms·
This is something that should be in the language, not some preprocessor. Like rust's ? operator.
by the_gipsy 3y ago
This is something that should be in the language, not some preprocessor. Like rust's ? operator.
- Animats 3y agoYes. Rust struggled with that for about three rounds of verbose error handling, until finally settling on "Result<useful, Error>" and "?". That seems to be about right. C++ exceptions are too much. Writing it all out as in C and Go is too little. The Rust solution is a good midpoint.
- masklinn 3y agoUh? Try! was added in 0.11, and the feature found to work well enough and be sufficiently valuable that ? superseded it in 0.13.
- debugnik 3y agotry! was added in 0.10 (2014), and ? was stabilized in 1.13 (2020), according to my quick check on GitHub releases. Note that the underlying traits to implement ? on custom types are still unstable.
- chrismorgan 3y agoCorrection: 1.13.0 was not released in 2020, but on 2016-11-10. The rest of the comment is accurate.
- debugnik 3y agoOh, noted. I guess Rust uploaded old releases to GitHub at some point during 2020, then.
- chrismorgan 3y agohttps://github.com/rust-lang/rust/blob/master/RELEASES.md https://github.com/rust-lang/rust/blob/master/RELEASES.md is an excellent file for finding all of this kind of stuff.