__Symbol an alternative to recursive templates for type-introsecption

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 8 21:28:00 PDT 2016


On Sunday, 9 October 2016 at 04:12:48 UTC, Nicholas Wilson wrote:
> On Sunday, 9 October 2016 at 03:05:22 UTC, Stefan Koch wrote:
>> So far it can be visualized as
>> struct __Symbol
>> {
>>   string name;
>>   __Symbol parent;
>>   /* MaybeLater:
>>   __SymbolType type;
>>   __Symbol[] members;
>>   ....
>>  */
>> }
>
> Infinite recursion if a struct, I assume you mean class :P

It's a special compiler Symbol :) therefore it would know
But for the sake of normal rules see it as
struct __Symbol
{
   string name;
   __Symbol* parent;
}


More information about the Digitalmars-d mailing list