DIP54 : revamp of Phobos tuple types

Timon Gehr timon.gehr at gmx.ch
Mon Dec 30 10:26:45 PST 2013


On 12/30/2013 07:45 AM, Andrei Alexandrescu wrote:
> ...
>>
>> If you are going to claim that this is not proper creation of an
>> instance of a type, except that:
>>
>> int x;
>> static assert(is(typeof(x)==int));
>>
>> Seq!(int, double) y;
>> static assert(is(typeof(y)==Seq!(int, double))); // presumably "bad"
>>
>> Then I don't know what to tell you. It is not useful at all to make a
>> terminological distinction between the two cases above and claim that
>> one is somehow special and confusing, when everything actually behaves
>> in an uniform way.
>
> The latter holds no state though.
>
> Andrei
>

alias Seq(T...)=T;

void main(){
     Seq!(int, double) y;
     y=Seq!(1,2.0);
     assert(y==Seq!(1,2.0));
     y[0]=2;
     assert(y==Seq!(2,2.0));
     y=Seq!(3,4.0);
     assert(y==Seq!(3,4.0)); int x;
}



More information about the Digitalmars-d mailing list