On Friday, 26 May 2017 at 17:17:39 UTC, Stanislav Blinov wrote:
Destructors of derived classes are called implicitly on
finalization. The net effect is that such finalization adopts
the weakest set of attributes among all the destructors it
calls.
I'm sorry, I ment explicitly. I hope it is not possible.
There are two sides of this problem: one is that we cannot have
deterministic destruction (i.e. manually allocate/free classes)
while keeping attribute inference: under current rules,
finalization has to be @system. This one can be tackled if the
language provided strict rules of attribute inheritance in
destructors.
Another side, clearly demonstrated by my second post, is that
non-deterministic destruction cannot be @safe, period. Because
when GC collects and calls destructors, it calls all of them,
regardless of their @safe status, even when the collection is
triggered inside a @safe function.
Doesn't that mean if compiler can't call inherited destructor
despite of GC it must be error?