AliasSeq + isExpression type specialization behavior

Marc Schütz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 10 08:32:32 PST 2015


On Tuesday, 10 November 2015 at 13:47:23 UTC, Brian Schott wrote:
> On Tuesday, 10 November 2015 at 10:28:45 UTC, Marc Schütz wrote:
>> This fails, too:
>> static assert(is(AliasSeq!(char) : AliasSeq!(dchar)));
>>
>> Which makes sense IMO, because it can be thought of as an 
>> unnamed struct, cp. the following:
>>
>> struct A { char c; }
>> struct B { dchar c; }
>> static assert(is(A : B)); // fails, as expected
>
> You're talking about Tuple. I'm talking about AliasSeq.

A Tuple is just a struct with an AliasSeq member. Or seen from a 
different POV, an AliasSeq can be interpreted as the "innards" of 
the struct. IMO it therefore makes sense to expect an AliasSeq to 
behave analogously to a struct. The only exception to that is 
that AliasSeq auto-expands, of course.


More information about the Digitalmars-d-learn mailing list