Tuple expansion already?

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 17 21:16:44 PST 2015


On Wednesday, 18 November 2015 at 02:21:04 UTC, rsw0x wrote:
> On Wednesday, 18 November 2015 at 02:19:34 UTC, Ali Çehreli 
> wrote:
>> For once, let's take something from C++. ;) Structured 
>> bindings are accepted for C++:
>>
>>   https://isocpp.org/blog/2015
>>
>> Assuming that f() returns a tuple,
>>
>>   auto {x,y,z} = f();
>>
>> will be the same as
>>
>>   auto t = f();
>>   auto x = get<1>(t);
>>   auto y = get<2>(t);
>>   auto z = get<3>(t);
>>
>> Ali
>
> Kenji already wrote(and implemented IIRC) a DIP for this, I 
> don't think it was ever approved.
> http://wiki.dlang.org/DIP32
>
> I wish D had better Tuple handling at the language level.

I wish as well, but we have a lot on the drawing board right now, 
I don'tt hink this is the time for that.

There have been proposal that are better than Kenji. 
Grammatically, Kenji's proposal have some serious problems, { is 
already the start of a delegate, a block statement, a struct 
literal, and I'm not sure what else, but too much.



More information about the Digitalmars-d mailing list