Le 25/09/2012 23:34, ixid a écrit :
You've shown it's clearly incompatible with the current language
and would break lots of code. What would it break if assignment
required explicit tuple brackets?

(int a, b) = foo(); // A tuple assignment, 'a' and 'b' will be
filled in order by the multiple return values of foo()

int foo() {
return 1;
}

(int a, b) = foo(); // Also valid and only sets 'a'


int, int foo() {
return 1, 2;
}

int a = foo(); // Also valid and 'a' takes the first tuple value

(int a, auto b) = foo(); // Evaluated left to right so 'a' will
take the first argument of foo and b will auto to a type or tuple
of what remains. It will error if there is nothing remaining for
b. This would still allow the clean expression of stand-alone
tuples and function arguments and return values.


This does not exist according to current language specs, so it is up to us to decide if it works and how.

int, string a = 1, "hello";
int, string foo(double, double a) {
return cast(int) (d[0] * d[1]), "hello";
}


This is incompatible with current language specs (or will ends up with highly bizantine rules do define what to do, in a topic where it is already complex).

Doesn't the needs of bracketing to determine order operation,
(stuff) more or less imply that implicit conversion between one
member tuples and the type of that tuple member is a requirement?
Or would the (stuff, ) syntax be better?

I don't know.

Reply via email to