Thoughts on possible tuple semantics

Dicebot public at dicebot.lv
Wed Aug 21 10:01:23 PDT 2013


On Wednesday, 21 August 2013 at 16:51:18 UTC, deadalnix wrote:
> On Wednesday, 21 August 2013 at 16:19:43 UTC, Dicebot wrote:
>> Hm, the wording feels wrong now. No, here is the idea:
>> auto a = tuple(1, 2);
>> foo(a, 3); // rejected
>> foo(a.expand, 3); // works
>>
>> "T..." here simply says, "work with T as it is a tuple but it 
>> is a normal function argument list in fact".
>>
>> so no packing actually happens here: "foo(1, 2, 3)", my mistake
>
> My concern here is to keep the foo(T...)(T args) equivalent to 
> template foo(T...) { foo(T args) }
>
> We also need to be more precise about what we mean when saying 
> packing/unpacking.

As far as I see it, equivalence will persist. However, this will 
change:

template foo(T...)
{
     void foo()
     {
         T values; // error, use "ctseq(T) values" instead, T... 
can't act as a single entity
     }
}


More information about the Digitalmars-d mailing list