Destructors vs. Finalizers

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 26 05:57:00 PDT 2017


On Wednesday, 26 July 2017 at 12:43:27 UTC, Steven Schveighoffer 
wrote:
>
> Regarding the OP, I think we really should strive to have 
> something to fix this issue.
>
> A poor-mans distinction could be done by checking whether the 
> GC is currently the one destroying (a flag is available, but 
> isn't publicly accessible), though that could get expensive.

That's essentially what Guillaume's "GC-proof resource class" 
idiom does now.

https://p0nce.github.io/d-idioms/#GC-proof-resource-class



More information about the Digitalmars-d mailing list