Release D 2.078.0
David Nadlinger
code at klickverbot.at
Thu Jan 4 17:40:55 UTC 2018
On Thursday, 4 January 2018 at 13:03:21 UTC, Mike Parker wrote:
> https://dlang.org/blog/2018/01/04/dmd-2-078-0-has-been-released/
> In normal D code, struct destructors are executed when an
> instance goes out of scope. This is handled by DRuntime, […]
This is slightly inaccurate. Regular stack cleanup doesn't
involve the runtime at all; druntime only comes into play for
exception handling. Since destructors also need to be run when
the scope is left by an exception, they are implemented via `try
{} finally {}` internally. The EH part of these depends on
druntime, but not the regular path.
> One of the seemingly obscure features dependent upon DRuntime
> is the ModuleInfo type. It’s a type that works quietly behind
> the scenes as one of the enabling mechanisms of reflection and
> most D programmers will likely never hear of it.
This is somewhat confusingly worded as well. It's actually mostly
the other way around – druntime depends on ModuleInfo to be
emitted, crucially for static constructor, destructors and unit
tests to be run. At least without shared libraries in the
picture, it would be fairly easy to manually look up the set of
ModuleInfos in a druntime-less D program.
— David
More information about the Digitalmars-d-announce
mailing list