Destructors vs. Finalizers

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 25 19:59:34 PDT 2017


On Wednesday, 26 July 2017 at 02:58:00 UTC, Mike Parker wrote:
>
> Internally, the runtime will treat each differently. an 
> rt_destruct would call all every __dtor in a hierarchy and 
> rt_finalize would be changed to call every __finalizer (a new 
> addition) in a hierarchy. When cleaning up, the GC will ensure 
> that all destructors are run where they exist, followed by all 
> finalizers. And destroy would be changed to call rt_destruct 
> instead of rt_finalize.
>
> Thoughts?

And an important bit I left out -- destroy would still call 
rt_finalize if no destructor is present, which would preserve 
current behavior.



More information about the Digitalmars-d mailing list