First life-signs of type functions

Stefan Koch uplink.coder at googlemail.com
Sat May 9 06:39:20 UTC 2020


On Wednesday, 6 May 2020 at 12:01:11 UTC, Stefan Koch wrote:
> On Wednesday, 6 May 2020 at 11:58:36 UTC, Stefan Koch wrote:
>> Now works on the Talias branch
>>
>
> https://github.com/dlang/dmd/compare/master...UplinkCoder:talias?expand=1
>
> As you can see the modifications aren't even that heavy.
> I am confident this will take significantly less time than 
> re-implementing CTFE.
> Because it's a new feature and bugs can be fixed as they are 
> discovered.

As of a few minutes ago the following code compiles without 
errors!

string fqn(alias t)
{
     string result = t.stringof;
     alias p;
     p = t;
     bool good = is(typeof(__traits(parent, p)));
     while(good)
     {
         p = __traits(parent, p);
         result = p.stringof ~ "." ~ result;
//        result = __traits(identifier, parent) ~ "." ~ result;
         good = is(typeof(__traits(parent, p)));

     }

     return cast(string) result;
}

struct S
{
     struct X
     {
         int xx;
         static assert( fqn!xx == "module " ~ __MODULE__ ~ 
".S.X.xx" );
     }
}



More information about the Digitalmars-d mailing list