nothrow by default

rikki cattermole rikki at cattermole.co.nz
Sun Jan 5 13:12:47 UTC 2020


There is another exception handling mechanism which has not been 
seriously suggested up until now, but now may be the time for it.

The basics are the same.
Up in the call tree is some sort of handler registered.
This will be a delegate. It returns an enum.

This enum will typically have members like error, prematureReturn, 
continue, and unroll.

The way this delegate get used is that it gets matched bottom up (like 
we do now), in the thrower. The throw statement will match the delegate 
to the exception, call the delegate and then proceed to do whatever that 
function tells it to do. It could assert out, return Return.init, 
continue doing stuff (which may lead to asserting out), or unroll to the 
handling point (which is what we want to avoid).

As this would be D only, it could be a lot cheaper and may not exhibit 
the same limitations as we have now.


More information about the Digitalmars-d mailing list