Dicebot:
int a, b, c;
tuple(a, b, c) = foo();
writeln(a, b, c); // 000
TypeTuple!(a, b, c) = foo();
writeln(a, b, c); // 123
}
One of the points of a good tuple syntax is to not need to define
the variables before (because in several cases you can't do that).
On Monday, 24 March 2014 at 16:59:37 UTC, bearophile wrote:
void foo(in auto tuple(a, b, c)) {}
This snippet does not make any sense.
It's equivalent to Python2.6 code:
def foo((a, b, c)):
A more complete Python2.6 program:
def foo((a, b, c)):
print a, "-", b, "-", c
t = (10, 20, 30)
foo(t)
Output:
10 - 20 - 30
In Haskell, OcaML, and other languages the code is similar. It's
a tuple unpacking syntax in the function signature.
The other example with foreach is very similar.
Bye,
bearophile