DConf talk : Exceptions will disappear in the future?

Jacob Carlborg doob at me.com
Thu Jan 7 10:31:24 UTC 2021


On 2021-01-06 22:27, H. S. Teoh wrote:

> That's the whole point of Sutter's proposal: they are all unified with
> the universal Error struct.  There is only one "backend": normal
> function return values, augmented as a tagged union to distinguish
> between normal return and error return.  We are throwing out nonlocal
> jumps in favor of normal function return mechanisms.  We are throwing
> out libunwind and all the heavy machinery it entails.
This is not what Sutter is proposing. He's proposing to add a new 
"backend", so you end up with three different types of functions (when 
it comes to error handling):

* Functions annotated with `throws`. This is the new "backend":

void foo() throws;

* Functions annotated with `noexcept`. This indicates a function will 
not throw an exception (of the existing style):

void foo() noexcept;

* Functions without annotation. This indicates a function that may or 
may not throw an exception (of the existing style):

void foo();

 From the proposal, paragraph 4.1.7:

"Compatibility: Dynamic exceptions and conditional noexcept still work. 
You can call a function that throws a dynamic exception from one that 
throws a static exception (and vice versa); each is translated to the 
other automatically by default or you can do it explicitly if you prefer."

But perhaps you're proposing something different for D?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list