On Monday, 24 March 2014 at 17:35:46 UTC, bearophile wrote:
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).
I understand but this is something that can be pretty hard to fit
into D semantics/grammar and I am not sold that it is worth the
push on its own.
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
What is the difference with this then?
void foo(int a, int b, int c)
{
// ...
}
auto t = tuple(10, 20, 30);
foo(t.expand);