compiler support added for precise GC
Steven Schveighoffer
schveiguy at yahoo.com
Wed Apr 18 11:53:03 PDT 2012
On Wed, 18 Apr 2012 14:37:11 -0400, Walter Bright
<newshound2 at digitalmars.com> wrote:
> 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);
> }
> }
The question was, can you get this information at compile time.
-Steve
More information about the Digitalmars-d
mailing list