Regarding the issue with `destroy` not being @nogc, I my understanding is it comes down to `rt_finalize` not being @nogc. I haven't dug too deeply into the discussions around it, but I'm wondering if it's possible to separate the concept of destruction from finalization in the implementation?

Externally, we can do it with the existing language:

class {
    ~this() {}     // Finalizer

    ~this @nogc {} // Destructor
}

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?

Reply via email to