@nogc, exceptions, generic containers... Issues.

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 8 16:53:18 PDT 2014


On Monday, 8 September 2014 at 15:55:53 UTC, monarch_dodra wrote:
> Any idea how to approach this problem?
>
> I know there are "workarounds", such as static pre-allocation, 
> but that also comes with its own set of problems.
>
> Maybe we could change it to say it's not legal to "hold on" to 
> exceptions for longer than they are being thrown? Then, we 
> could create the exceptions via allocators, which could 
> deterministically delete them at specific points in time (or by 
> the GC, if it is still running)? Just a crazy idea...

This is pretty much what we do in Sociomantic code base, re-using 
all exception instances and declaring that holding those (or 
making a fiber switch while handling) is illegal by convention.

Only other option I can imagine is to use reference-counted 
exception pools but this can't be implemented in the current 
language state.


More information about the Digitalmars-d mailing list