Detecting alias declarations - the dodgy way (but it works for me!)

Ethan gooberman at gmail.com
Tue May 22 20:38:16 UTC 2018


On Tuesday, 22 May 2018 at 20:34:34 UTC, Ethan wrote:
>         foreach( MemberName; __traits( allMembers, Parent ) )
>         {
>             if( MemberName == SymbolName )
>             {
>                 mixin( "alias ThisSymbol = Alias!( " ~ 
> fullyQualifiedName!Parent ~ "." ~ SymbolName ~ " );" );
>                 return SymbolName != ThisSymbol.stringof;
>             }
>         }

Looking over it, I questioned why I was doing this loop. It 
should work just the same without the loop, although as far as 
error checking goes you'd want to do a __traits( compiles ) test 
on that alias mixin before going ahead and performing that code.


More information about the Digitalmars-d mailing list