Plan for Exceptions and @nogc?

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 17 16:14:53 PST 2015


On Tuesday, 17 February 2015 at 19:03:49 UTC, Chris Williams 
wrote:
> Every throwable function call could be assumed to have a typed 
> result (even void functions) and if, after the return, the 
> caller checks the type and detects that it was an error, 
> bubbles that up, then eventually you get to wherever the 
> catcher is.
>
> But so basically, the current ABI doesn't support it and 
> there's no desire to change it? How do exceptions currently 
> happen, if not via some official ABI declaration of how 
> throwable methods interact with one another? The 
> compiler/linker determines where the catcher is and inserts 
> code to cut down the stack and perform a long jump all the way 
> back? If so, how do scope statements work?

This kind of stunt is taxing on the fast path. It can be 
implemented as setjmp/longjmp but is more and more avoided in 
favor of libunwind based solutions for languages that have code 
running on unwinding.

libunwind based solution is slower to unwind, but is not very 
taxing in the fast path (only prevent some optimizations to be 
done like tail call).

This solution is a non starter perforamnce-wize for D.


More information about the Digitalmars-d mailing list