Finalizers, Destructors, RAII, GC

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Apr 28 15:17:01 UTC 2021


On Wednesday, 28 April 2021 at 14:43:24 UTC, 12345swordy wrote:
> Split the finalizer from the destructor and make the finalizer 
> an interface.

Interfaces are expensive. I think it could be in the vtable. It 
should also support inheritance.

One should be able to inherit a superclass which has a finalizer 
that supports GC and then make a RAII subclass from it.

There is also a need to annotate pointers which are known to not 
point to GC memory, maybe @nogc could be reused for that. Then 
you would only be allowed to read @nogc pointers within a 
finalizer.





More information about the Digitalmars-d mailing list