I hate class destructors with a burning passion

Guillaume Piolat first.last at gmail.com
Sun Jun 6 19:00:48 UTC 2021


On Sunday, 6 June 2021 at 18:55:47 UTC, Guillaume Piolat wrote:
> On Sunday, 6 June 2021 at 14:19:39 UTC, Imperatorn wrote:
>> On Sunday, 6 June 2021 at 11:54:40 UTC, Mathias LANG wrote:
>>> Over the past few months, more than half of the critical bug 
>>> we've encountered which were not due to our own code are 
>>> related to destructors. Specifically, destructors being 
>>> invoked by the GC.
>>>
>>> [...]
>>
>> What would be some sensible solutions to these issues?
>
> Two first issues can be avoided by not letting the GC call 
> class destructors, and call them deterministically instead.

Also, you knew it was coming: 
http://p0nce.github.io/d-idioms/#GC-proof-resource-class

is all you need and has been an existing solution for 6 years.


More information about the Digitalmars-d mailing list