DMD 2.042 -- what happened to ModuleInfo.name?

Trip Volpe mraccident at gmail.com
Tue Mar 23 01:42:19 PDT 2010


I recently upgraded from DMD 2.03something to the latest alpha. Previously, I was able to do this:

import std.stdio;
import core.runtime;

void main() {
   foreach( m; ModuleInfo ) {
      writefln( m.name );
   }
}

Which would list the names of all modules. I was using the property to provide useful feedback from a custom unit testing function. However, in DMD 2.042, it seems that the ModuleInfo struct has been pared down to contain only the unitTest property. Very inconvenient, if I may say so!

FWIW, I found that if I just sneak into src/druntime/import/object.di and add "@property string name();" to the ModuleInfo struct, everything works as before -- the name property is defined in src/druntime/src/object_.d, so I'm curious as to why it's excluded from the core.runtime-facing version.

Is there a particular reason for this? Is there some new part of the runtime that I should be using to examine module names and unit tests?

...And am I going to explode anything by modifying druntime/import/object.di to include the missing property?  :-P



More information about the Digitalmars-d mailing list