Finalizers, Destructors, RAII, GC
12345swordy
alexanderheistermann at gmail.com
Wed Apr 28 21:12:08 UTC 2021
On Wednesday, 28 April 2021 at 15:17:01 UTC, Ola Fosheim Grøstad
wrote:
> 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.
How on earth are interfaces expensive?
-Alex
More information about the Digitalmars-d
mailing list