19340, "mppf", "How should tuple declarations interact with multiple variable declarations?", "2022-03-02T14:57:09Z"
This issue asks a questions about how tuple declarations should combine with multiple variable declarations. See also Variables — Chapel Documentation 1.25 and Tuples — Chapel Documentation 1.25 .
Today we have multiple variable declarations. The spec says:
var v1, v2, v3: t;
is translated in to
var v1: t; var v2: v1.type; var v3: v1.type;
we also have tuple variable declarations, e.g.
var (a, b) = (1, 2);
To what extent does the language allow combining these features?
It appears that, today, we can combine them as long as tuple declarations all have an initializer and a type. So this compiles:
var a, b=1, (c, d): (int, int);
writeln(a,b,c,d);
but this does not:
var (a, b), (c, d): (int, int);
writeln(a,b,c,d);
(it fails to compile with an error like error: use of 'tmp' before encountering its definition, type unknown
).
Is this where we want to draw the line on the feature? Or, should
var (a, b), (c, d): (int, int);
translate into something equivalent to this:
var (a, b): (int, int), (c, d): (int, int);
?