On 10/7/10 1:43 CDT, Russel Winder wrote:
On Wed, 2010-10-06 at 23:08 -0700, Walter Bright wrote:
If expr represents a tuple, we (Andrei and I) were thinking about the syntax:
auto (a, b, c, d) = expr;
being equivalent to:
auto t = expr; auto a = t[0]; auto b = t[1]; auto c = t[2 .. $];
You can also do this with arrays, such that:
float[3] xyz;
auto (x, y, z) = xyz;
The Lithpers among you will notice that this essentially provides a handy
car,cdr shortcut for tuples and arrays:
auto (car, cdr) = expr;
Python may be the best base to compare things to as tuple assignment has
been in there for years.
Pythons choice is not a car/cdr approach but an exact match approach.
So then we'd have the proposed notation not work with dynamic arrays -
only with static arrays and tuples.
Andrei