Thanks for reading!

On Thursday, 10 November 2016 at 06:08:22 UTC, thedeemon wrote:
This is the schizophrenic part of D, since allocations inside destructors are not allowed by its own runtime and cause immediate stop of the program.


But this restriction is only there when called by the GC. If you have GC and a deterministic object graph, it can be completely safe to allocate in destructor.
I feel this is a separate problem, "GC calling destructors".

And exceptions in destructors should not be allowed: there is no sane place to catch and handle exceptions arising during the GC phase (which can be triggered by arbitrary allocation anywhere in the code), so if we can't reason about them and handle them we shouldn't allow them.

Good point.

Reply via email to