On Thursday, 10 November 2016 at 00:56:02 UTC, Guillaume Piolat wrote:

Great post and useful pieces of code, thanks!

"every class object's destructor is assumed to throw exceptions and use the GC by default."

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. A sane language would either insist on making all destructors @nogc or allow some allocations during the GC phase (like CLR and JVM do, I suppose).

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.

Reply via email to