Destructors vs. Finalizers

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 26 06:10:47 PDT 2017


On 7/26/17 8:57 AM, Mike Parker wrote:
> 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
> 

Yeah, I've seen that.

https://issues.dlang.org/show_bug.cgi?id=17563

-Steve


More information about the Digitalmars-d mailing list