[rust-dev] "let mut" <-> "var"

Daniel Micay danielmicay at gmail.com
Wed Jan 29 19:05:18 PST 2014


On Wed, Jan 29, 2014 at 9:52 PM, Sean McArthur <smcarthur at mozilla.com> wrote:
> Part of the nice thing about `let mut` is that it requires you to opt-in to
> mutability, making it a conscious choice.
>
> Having `let` and `var` would make Rust be like ES6: we all look at `let` and
> say "why bother". For Rust, I imagine many would get into the habit of using
> `var` over `let` because it's easier, and as code samples show up using it,
> newcomers would default to using `var`.

Rust does give a warning when variables are unnecessarily mutable.


More information about the Rust-dev mailing list