On Wednesday, 30 April 2014 at 20:21:33 UTC, Andrei Alexandrescu
wrote:
First off, we're considering eliminating destructor calls from
within the GC entirely. It makes for a faster and better GC,
but the real reason here is that destructors are
philosophically bankrupt in a GC environment. I think there's
no need to argue that in this community. The GC never
guarantees calling destructors even today, so this decision
would be just a point in the definition space (albeit an
extreme one).
That means classes that need cleanup (either directly or by
having fields that are structs with destructors) would need to
garner that by other means, such as reference counting or
manual. We're considering deprecating ~this() for classes in
the future.
I'm all for it, this will break code that was not correct in the
first place, and was working by accident.
Also, being called by the GC from any thread prevent many kinds
of cleanup, such as those with a thread-wise bound context (CUDA,
OpenGL, etc...).