Alternatives to exceptions for error handling

Paulo Pinto pjmlp at
Sun Nov 22 18:17:58 UTC 2020

On Sunday, 22 November 2020 at 17:37:18 UTC, Roman Kashitsyn 
> In the video from DConf 2020 about @live functions 
> ( Walter mentioned that all @live 
> functions are nothrow.  He also thinks that exceptions are 
> obsolete.
> I've been programming in Google's C++, Go & Rust for quite a 
> few years and I couldn't agree more with this assessment.  
> Error handling is a very important part of program engineering, 
> and having errors reflected in function return types is very 
> useful in practice.  This helps a lot with constructing correct 
> programs.
> So my question is: does/will D provide support for alternative 
> approaches to error handling?  In practice, this typically 
> includes 2 things:
> 1. A sum type that contains either a result or an error. Like 
> Result in Rust or Expected that Andrei proposed for C++.  It's 
> easy to implement in D, but having this in Phobos would be nice.
> 2. Some kind of syntactic sugar for propagating errors upstream 
> (? macro in Rust, check/handle proposal in Go 
>, an ugly macro in C++, etc.).

You won't need ugly macros in C++,

More information about the Digitalmars-d mailing list