Le 25/09/2012 03:19, ixid a écrit :
What would a special case where the first level of tuple (with higher
levels being tuples in tuples) didn't require parens break? This would
be a beautiful syntax:
auto a = 1, 2; // A tuple of two ints
int, string fun(double, double d) {
return cast(int) (d[0] * d[1]), "hello";
}
auto a, b = 1, 2; // Two ints
auto a = fun(1.0, 1.0); // Tuple of 1 and "hello".
auto a, b = fun(1.0, 1.0); // An int and a string.
It can get pretty confusing with , separated declarations :
int a, b = 3;
or worse :
int a, int b = foo();
-->
(int a, int b) = foo();
or
int a, (int b = foo());
and it gets worse with int a, auto b = foo();
But I do agree that this is really nice in many places.