On 11/08/2011 6:00 PM, Brendan Eich wrote:
Also, what I'd like to do is this:
let x, y = 1, 2;
JS1.8.x today:
let [x, y] = [1, 2];
Optimizes to avoid array construction.
Wish we didn't have [] all over, but I foolishly cloned C/C++/Java's comma
operator.
We'd have to (at minimum, I think) write patrick's example as:
let (x, y) = (1, 2);
since a naked-comma-makes-a-tuple would make situations like function
argument lists ambiguous. We'd be adding a mode to the parser where it
"knows" it's inside an simple-paren pair and should consider comma to
mean tuple-formation. Unless you know a different trick.
I wonder if we can get away with just saying that a *let* declaration
permits multiplicity, the same way it permits trailing optional
typarams; if this is truly the important case that's biting. It's
decidedly less work to support a declarator form:
let x = 1, y = 2;
than to add (even if re-adding) another tycon.
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev