Current state of "D as a better C" (Windows)?

Jacob Carlborg doob at me.com
Fri Jan 24 01:07:30 PST 2014


On 2014-01-24 06:17, Mike wrote:

> That sounds very undesirable.  I still don't even understand what
> purpose modules and ModuleInfo really serve.  Right now, I'm just using
> modules for namespace scope and encapsulation.  If you know some
> documentation that helps demystify ModuleInfo and what its purpose is
> (besides the source code) please point me to it.

ModuleInfo contains, for example, module constructors:

module foo;

static this () { // run once before every thread is started }
shared static this () { // run once before main is called }

It also provides a way to iterate all modules, at runtime. From each 
module it's possible to iterate all local classes and all imported 
modules. Object.create which will return a new object of a class given 
by its fully qualified name, as a string. Object.create is implemented 
using ModuleInfo.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list