What about constant folding? Surely let mut x = 10 is easier for the
compiler to optimise?


On 30 January 2014 16:18, Daniel Micay <[email protected]> wrote:

> On Wed, Jan 29, 2014 at 10:09 PM, Samuel Williams
> <[email protected]> wrote:
> > I agree that it is syntactic salt and that the design is to discourage
> > mutability. I actually appreciate that point as a programmer.
> >
> > w.r.t. this specific issue: I think what concerns me is that it is quite
> a
> > high burden for new programmers (I teach COSC1xx courses to new students
> so
> > I have some idea about the level of new programmers). For example, you
> need
> > to know more detail about what is going on - new programmers would find
> that
> > difficult as it is one more concept to overflow their heads.
>
> Either way, Rust is going to warn when there is unnecessary mutability.
>
> > Adding "var" as a keyword identically maps to new programmer's
> expectations
> > from JavaScript. Writing a program entirely using "var" wouldn't cause
> any
> > problems right?
>
> Rust has block scope, so `var` would match what `let` does in JavaScript.
>
> > But, could be optimised more (potentially) if using "let" for immutable
> parts.
>
> It really doesn't introduce any potential optimizations.
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to