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


  • Re: Releas... Seb via Digitalmars-d-announce
  • Re: Releas... H. S. Teoh via Digitalmars-d-announce
  • Re: Releas... Seb via Digitalmars-d-announce
  • Re: Releas... Mike Parker via Digitalmars-d-announce
    • Re: R... Mike Parker via Digitalmars-d-announce
      • R... Joakim via Digitalmars-d-announce
        • ... Mike Parker via Digitalmars-d-announce
      • R... jmh530 via Digitalmars-d-announce
        • ... Mike Parker via Digitalmars-d-announce
          • ... Jack Stouffer via Digitalmars-d-announce
      • R... David Nadlinger via Digitalmars-d-announce
        • ... Mike Parker via Digitalmars-d-announce
        • ... Mike Franklin via Digitalmars-d-announce
  • Re: Releas... Walter Bright via Digitalmars-d-announce
  • Re: Releas... thedeemon via Digitalmars-d-announce
    • Re: R... Rainer Schuetze via Digitalmars-d-announce
      • R... thedeemon via Digitalmars-d-announce
  • Re: Releas... IM via Digitalmars-d-announce
  • Re: Releas... Глеб Куликов/Gleb Kulikov via Digitalmars-d-announce
    • Re: R... rikki cattermole via Digitalmars-d-announce
    • Re: R... user789 via Digitalmars-d-announce

Reply via email to