On Tue, 2 Apr 2013 Jeaye Wilkerson <[email protected]> wrote:
>
> `let mut` makes more sense to me than `mut` simply because `let` is already a 
> declarator.
> mut, to me, is an attribute, not a declarator. I think we should keep the 
> `let mut` syntax
> because it's still a `let` (with regard to scope), but it's mutable. Concise? 
> Eh, it's consistent
> and predictable.

Since this topic came up, I just wanted to throw out something that
has been on my mind while
lurking here:  (Hi everybody!)

I'm particularly fond of Scala's solution to this design challenge:
they took the 'val' declarator from
the ML family  of languages and supplemented it with another
declarator called 'var' with mutable semantics.

val x = ... // immutable binding
var y = ... // mutable binding

This has nice properties when visually scanning code: if you have a
block of bindings they're
vertically aligned regardless of mutability.  They're similar enough
so that a casual glance identifies
either as being a binding, but different enough to easily identify
where your mutability is.

It just seemed like an elegant touch to me.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to