DIP32: Uniform tuple syntax

Timon Gehr timon.gehr at gmx.ch
Fri Mar 29 06:34:36 PDT 2013


On 03/29/2013 02:17 PM, Simen Kjærås wrote:
> On Fri, 29 Mar 2013 13:56:08 +0100, bearophile
> <bearophileHUGS at lycos.com> wrote:
>
>> One handy tuple syntax in Haskell allows you to name both the items of
>> a tuple and it whole:
>>
>>
>> void foo(t2@{int a, string b}) {
>>     // here a and b are tuple items and t2 is the whole tuple.
>> }
>> auto t1@{x, y} = {10, "hi"};
>> foo(t1);
>
> I suggest instead this syntax:
>
> auto {x, y} t1 = {10, "hi"};
>
> It's closer to regular D syntax.
> ...

It is already taken and equivalent to:

{x, y} t1 = {10, "hi"};



More information about the Digitalmars-d mailing list