On 5/18/22 2:02 PM, Ali Çehreli wrote:
Of course, we still should and do have the power to shape our programs
any way we want but I think '@disable ~this();' should be added to
classes as a general rule unless the programmer knows it will work
otherwise.
What do you think?
No. Class destructors are for cleaning up non-GC resources. As long as
you stick to those, you can safely run them.
Structs that get put into classes have to run their destructors
properly, otherwise, you will have horrible inconsistencies.
For instance, I would not want to disable the destruction of a
RefCounted struct inside a class.
You can use the GC.inFinalizer to check if you are concerned about using
the GC in your struct dtors.
-Steve