I just wanted to say thank you to @withoutboats for this proposal. Having tried to champion a new Python stdlib feature that ultimately got shot down, I sympathize that it can be frustrating when you work towards an idea but other people don’t assign the same values to the cost function involved with adding the feature.
I think everyone can agree that proper error handling in any language is very difficult, but the computer science field as a whole has been making steps slowly in the right direction.
Consider C, where return values from something like write(socket, ...) can return either the number of bytes sent, or signal an error that an error has occurred (which can be inspected in another global value, errorno). There’s no way statically to enforce that this error is read, must less handled correctly.
When I left work on Friday, I found that my C++ program had thrown an unhandled out_of_range exception. Since C++ doesn’t include stack traces or have something like ?, I’m in for some serious debugging to find even where that was thrown, much less fix it.
Rust’s Result<>, ?, and panic! are (in my opinion) huge innovations here. They solve very real problems, but of course there is a cost associated with them (as @withoutboats has described).
My point to all of this is that we need proposals like this in order to push the field farther, because I think Rust is at the very forefront of systems programming technologies. They may not always pan out, but we shouldn’t discourage each other from continuing to explore this space. We of course must be conservative and cautious. Another excellent example (from @withoutboats of course) is the failure crate, which clearly innovates in this space.
So in summary, thank you to everyone for the proposal and feedback. Let’s use this feedback to imagine new ways to improve error handling and make history.