I hate class destructors with a burning passion

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Jun 7 11:02:38 UTC 2021


On Monday, 7 June 2021 at 10:51:02 UTC, Mike Parker wrote:
> The alternatives (adding a separate finalizer, or preventing 
> the GC from calling destructors) are massively breaking 
> changes, so I don't see that happening. Even had destruction 
> and finalization been separate from the beginning, I'm sure 
> people would have misused the finalizer anyway just as they did 
> in older versions of Java.

Breaking changes for memory management are eventually needed, but 
they should not come one after another. It has to be designed as 
a whole.

So, if you want finalization, you need to start by making 
strongly typed unions and enable precise collection.



More information about the Digitalmars-d mailing list