Possibility of adopting Rust's Error Handling?

mee6 mee6 at lookat.me
Fri Apr 1 15:31:49 UTC 2022


On Friday, 1 April 2022 at 06:17:53 UTC, Paulo Pinto wrote:
> On Thursday, 31 March 2022 at 21:21:04 UTC, mee6 wrote:
>> Rust's error handling is pretty good, I think they've proved 
>> the use of Result!(T, E)....
>
> It has some warts still, that is why packages like these exist,
>
> https://docs.rs/thiserror/latest/thiserror/
>
> https://docs.rs/anyhow/latest/anyhow/
>
> To work around the boilerplate and lack of support in standard 
> library when combining errors from different libraries.
>
> Rust still suffers from a npm like approach to stuff that 
> should be part of the standard library for basic stuff, error 
> definition, async runtimes, serialization,...

Yes it seems they don't want to commit on those extensions. They 
seem to not want to define what an error is which leads to that 
problem. It can be avoided by including those things in the 
implementation details. C++ has an expect struct in the pipeline 
but it doesn't define what an error is either, nor how to handle 
multiple error types. That would need to be worked on as well.


More information about the Digitalmars-d mailing list