For what it's worth, when I was implementing `let mut` I did a straw poll at the time whether

    let mut a = 1, b = 2;

should declare both a and b as mutable or only a, and the response at the time was uniformly in favor of "both a and b" (which surprised me, since I had intended to do the opposite). 


Niko

April 9, 2013 11:11 PM



On Tue, Apr 9, 2013 at 11:16 PM, Benjamin Striegel <[email protected]> wrote:
One argument in favor of John's proposal is that:

    let mut foo = 1,
        bar = 2;

somewhat deceptively declares bar as mutable. However, a lint pass for never-mutated mutable variables (which we'd want anyway) would catch this.


Ouch! I think the semantics of the above is far from obvious and slightly dangerous.

Alexander
 
It's still a rather convenient form, though.


On Tue, Apr 9, 2013 at 1:34 PM, Benjamin Striegel <[email protected]> wrote:
I use it frequently enough for conciseness. I'm having a hard time thinking of a language that *doesn't* support a construction. Does it cause a problem with formalizing the grammar?


On Tue, Apr 9, 2013 at 1:04 PM, John Clements <[email protected]> wrote:
I've recently become aware of the existence of a comma-separated local-variable declaration in Rust. Would people object strongly to the removal of this form?

John

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev



_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev


_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
April 9, 2013 2:16 PM
One argument in favor of John's proposal is that:

    let mut foo = 1,
        bar = 2;

somewhat deceptively declares bar as mutable. However, a lint pass for never-mutated mutable variables (which we'd want anyway) would catch this.


It's still a rather convenient form, though.



_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
April 9, 2013 10:34 AM
I use it frequently enough for conciseness. I'm having a hard time thinking of a language that *doesn't* support a construction. Does it cause a problem with formalizing the grammar?



_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
April 9, 2013 10:04 AM
I've recently become aware of the existence of a comma-separated local-variable declaration in Rust. Would people object strongly to the removal of this form?

John

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to