Destructors vs. Finalizers

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 26 07:10:19 PDT 2017


On Wednesday, 26 July 2017 at 13:54:15 UTC, Guillaume Piolat 
wrote:
> On Wednesday, 26 July 2017 at 12:35:19 UTC, Mike Parker wrote:
>> On Wednesday, 26 July 2017 at 12:19:15 UTC, Guillaume Piolat 
>> wrote:
>>>
>>> I don't get the distinction between destructors and 
>>> "finalizers" but imho the problem is very much that the GC is 
>>> calling ~this.
>>
>> Destructors are deterministic, finalizers are not. At least, 
>> that's how I understand the terms are commonly used.
>
> Note that Andrei once proposed in 2014 that the GC wouldn't 
> call destructors/finalizers at all:
>
> [...]

AFAICT that was mostly because it would have broken plenty of 
existing code.
Properly separating destruction and finalization from each other 
with the current syntax remaining as finalizers and the new one 
for destructors would allow this to be done without major code 
breakage.


More information about the Digitalmars-d mailing list