Tuple DIP

Timon Gehr timon.gehr at gmx.ch
Thu Mar 15 15:57:56 UTC 2018


On 15.03.2018 11:45, ixid wrote:
> On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote:
>> auto (a, b) = (1, 2);
> 
> For the assignment and unpacking grammar why not adopt [...] Go syntax?
> ...

It does not fit in.

> auto a, b = 1, 2; // Creates two new variables with the values 1 and 2
> auto c, d = 1, (2,3); // A normal variable and a tuple
> ...

For this use case, there is already this:

auto a = 1, b = 2;
auto c = 1, d = (2, 3);


Under your proposal, this would now suddenly parse as:

auto a = ((1, b) = 2);
auto c = ((1, d) = (2, 3));



More information about the Digitalmars-d mailing list