Plan for Exceptions and @nogc?

Jonathan Marler via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 18 10:02:13 PST 2015


On Wednesday, 18 February 2015 at 14:46:30 UTC, Dicebot wrote:
> From my POV best proposal from last lengthy discussion was to 
> enable reference-counted non-gc-heap Exceptions. But that needs 
> a language change because RefCounted!T is a struct and thus 
> neither can be thrown nor can be part of Throwable class 
> hierarchy.
>
> Any concept that implies that exceptions an be deallocated in 
> `catch` block is absolutely unacceptable because it conflicts 
> with exception propagation from fibers - a very important piece 
> of functionality.

RefCounted Exceptions would work quite nicely.  You are right 
that It will require work on the language to support them but I 
like that solution.

If you don't mind, could you explain why cleaning up exception in 
the catch block would break exception propogation from fibers.  
Are you saying that if you throw inside a catch block and save a 
reference to the exception (in the new exceptions "next" field), 
that it will create a dangling pointer?


More information about the Digitalmars-d mailing list