Hi, Actually on that note I want to put more emphasis on this part:
On 10/02/2014 11:40, Armin Ronacher wrote:
Annoyingly enough this also means that the results need to be compatible which is still a problem. The example there would be an IO trait that is implemented by another system that also has its own error cases. Case in point: SSL wrapping that wants to fail with SSL errors in addition to IO errors. I fail to understand at the moment how library authors are supposed to deal with this.
I played around with some general helper methods on Result (such as and_then) to see how nice it can be built but the fact that the error cases need to be compatible with each other is a major pain point.
In Python and other languages with exceptions you just introduce new runtime exceptions and that's the end of it. In C you have usually one sentinel value that indicates failure and then various modes to check what failure means (for instance thread local error information, error information on a context struct etc.)
In Rust exceptions do not exist and error information stashed away somewhere else we basically just removed (in the form of conditions).
I really feel like there is a tool missing in the box. Regards, Armin _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
