Plan for Exceptions and @nogc?

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 18 06:46:28 PST 2015


On Monday, 16 February 2015 at 23:17:03 UTC, Jonathan Marler 
wrote:
> Is there a proposal for how D will support throwing Exceptions 
> in @nogc code in the future?  I've searched the forums and 
> found different proposals that involve things like 
> pre-allocated exceptions, non-gc heap allocated exceptions or 
> even stack allocated exceptions.  I don't want to debate the 
> details of each solution, I'd just like to know if any of these 
> proposals are deemed a "good idea", or if any of them are 
> currently being worked on.  I personally think that using 
> non-gc heap allocated exceptions in combination with the new 
> scope semantics would be a great solution in many cases, but I 
> don't know if there is any consensus or if this topic is just 
> on the back-burner. Thanks.

 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.


More information about the Digitalmars-d mailing list