compiler support added for precise GC

Walter Bright newshound2 at digitalmars.com
Wed Apr 18 11:37:11 PDT 2012


On 4/18/2012 10:20 AM, Steven Schveighoffer wrote:
> On Wed, 18 Apr 2012 09:59:10 -0400, Jacob Carlborg <doob at 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);
             }
         }


More information about the Digitalmars-d mailing list