www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Template mixins at compile-time

I've been experimented with D's template system and noticed some strange thing.
Here is the sample code.

template Foo(string className)
{
  class Bar
  {
  }

  mixin("alias Bar " ~ className ~ ";");
}

After that I have new class with the given name and everyting is ok. But I
can't create it with Object.factory() method.
In fact, I can call typeid() for this class and recieve correct information
about it. `Foo!("bla").Bar` for example. I've examined source code of the
Object.factory() and found out that ModuleInfo doesn't contain information
about created class.
I don't know much about how this information is generated at compile-time but
suppose that it should be generated after mixins will be evaluted.
Could anybody clear it up?
Oct 27 2008