Tuple DIP

Timon Gehr timon.gehr at gmx.ch
Sat Feb 17 04:46:53 UTC 2018


On 16.02.2018 21:01, Martin Nowak wrote:
> On 01/14/2018 12:21 AM, Timon Gehr wrote:
>>> what would be the equivalent of this ?
>>> ` writeln(tuple!("x", "y", "z")(2, 3, 4).y); `
>>
>> It would continue to work the same way.
>>
>> I did consider adding a proposal for built-in named tuple syntax:
>>
>> writeln((x: 2, y: 3, z: 4).y);
>>
>> (int a, double b) t = (a: 1, b: 2.0);
>> int x = t.a;
>> double y = t.b;
> 
> Tuples are anonymous bundles, when you want a product type with field
> names use a struct.
> 

I agree, but Phobos does not.


More information about the Digitalmars-d mailing list