Wait, what? What is AliasSeq?

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 8 11:01:39 PDT 2015


On 7/8/15 1:44 PM, Timon Gehr wrote:
> On 07/08/2015 11:38 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?=
> <schuetzm at gmx.net>" wrote:
>>
>>
>> I like "AliasTuple" as suggested by Martin, although it isn't a perfect
>> fit either when you think of `alias` template params, which don't match
>> `int`, while `int` can be an element of a TypeTuple.
>
> But this works: alias Int = int;
>
> The right fix for this issue is to fix the language. This does not make
> any sense.

Yes, Walter at dconf also (I think) agreed this at least needs to be fixed:

alias Int = int;

template T(alias X) { enum a = 1;}

int x = T!Int.a; // error

In addition, this doesn't work:

alias foo = 2;

But this does:

int x = T!2.a;

I think alias should be the same anywhere you use it. And Alias<insert 
term here> for a name for what TypeTuple/Arguments/AliasSeq is, seems 
like an appropriate name given how template aliases work. Not my 
favorite, but it's at least based in logic.

-Steve


More information about the Digitalmars-d mailing list