"Dario Schiavon" , dans le message (digitalmars.D:167822), a écrit :
> void main() {
>    alias TypeTuple!(1, 2) a;
>    alias TypeTuple!(a, 3) b;  // appends 3 to a
>    writeln(b);  // prints "123"
> }
> 
> Appending items to tuples actually covers 99% of my needs of 
> single-item tuples in Python. Can anyone find other needs for 
> single-item tuples? Or for empty tuples?
> 
>>
>> However, another point of my post was whether we really need 
>> Records (std.typecons.Tuple's), which take approximately the 
>> same role as traditional struct's after all, to allow returning 
>> multiple values from functions. Wouldn't AliasTuples take on 
>> the role as well?


Personally, I don't like Tuple unpacking automagically. It prevents 
creating a single element Typle, or a Tuple of Tuple, which may be 
harmful if Tuple gain a greater role than they have now. Creating a 
Tuple of Tuple is impossible or require heavy workarrounds with 
automagically unpacking Tuples, whereas with not automagically unpacking 
Tuples, it is very easy to introduce an unpacking syntax when necessary 
with a random unary operator.

-- 
Christophe

Reply via email to