On Wednesday, 26 July 2017 at 18:33:58 UTC, Moritz Maxeiner wrote:
On Wednesday, 26 July 2017 at 17:38:28 UTC, Dgame wrote:
I don't get it. The GC collects the objects which aren't in
use anymore. The order in which this is currently happening is
not specified. So, how are the destructors supposed to be
called in the right order? Manually? ARC?
After the split:
Destructors are only for deterministic end of object lifetime,
so yes, they are to be called by any scheme (such as manual
management via destroy and reference counting - which is likely
also implemented as calling destroy) that is deterministic.
Finalizers are for nondeterministic schemes such as the GC.
The GC *never* calls destructors directly, only finalizers.
A finalizer might manually call a destructor, but a destructor
may never call a finalizer.
Alright, thanks for the clarification. I've briefly hoped for
some sort of miracle such as deterministic object lifetime
without manual interaction. :)