On Wed, 18 Apr 2012 14:37:11 -0400, Walter Bright <newshou...@digitalmars.com> wrote:

On 4/18/2012 10:20 AM, Steven Schveighoffer wrote:
On Wed, 18 Apr 2012 09:59:10 -0400, Jacob Carlborg <d...@me.com> wrote:

On 2012-04-18 03:11, Nick Sabalausky wrote:
Can't you just query compile-time information to see what classes inherit
from Base? Then you could just try downcasting to them.

Is that possible?

No. Not from within a template that doesn't know about those classes (which
presumably your serialization function is).

-Steve

You can get a list of classes in the executable at runtime from:

         foreach (m; ModuleInfo)
         {
           if (m)
             //writefln("module %s, %d", m.name, m.localClasses.length);
             foreach (c; m.localClasses)
             {
                 writefln("\tclass %s", c.name);
             }
         }

The question was, can you get this information at compile time.

-Steve

Reply via email to