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

Tim Chevalier catamorphism at gmail.com
Thu Jan 30 09:18:33 PST 2014

I'm surprised that no one has mentioned so far that there was a
previous, exhaustive, discussion of this question on github:


As far as I can tell, this thread adds nothing new that wasn't already
discussed in the comments on #2643. So that strongly suggests to me
that nothing needs to be changed.


On Thu, Jan 30, 2014 at 8:49 AM, Steven Fackler <sfackler at gmail.com> wrote:
> The Zen of Python also says "There should be one-- and preferably only one
> --obvious way to do it."
> Steven Fackler
> On Thu, Jan 30, 2014 at 11:35 AM, Donaldo Fastoso
> <donquestion at rocketmail.com> wrote:
>> I like python's rational of "consenting adults": Give people the tools
>> to do the right thing, if they still want to hurt themselves, they may
>> have a good reason, or they are better of dead! ;-)
>> I would argue, that people choosing Rust over C/C++ are choosing it
>> BECAUSE of safety measures like immutability and wouldn't need
>> overbearing lectures.
>> In all honesty it's not the TYPING of three additional chars "let mut",
>> but the READING. It interrupts the flow of reading, or better: it's
>> a bump in the flow of scanning. Source-Code is not prosa, you have to
>> actively follow the train of thought and guess the intentions of the
>> author. So improving READABILITY would really be nice, especially
>> for people coming from other languages. They would probably try to
>> learn by reading the source from experienced programmers.
>> In this case i would also advice against the use of "var", instead
>> of "let mut", but omitting "let" and leave it to "mut" would be much
>> easier to read and understand.
>> so
>> "let mut x, y;"
>> would become:
>> "mut x;"
>> "let y;"
>> which would take a possible interpretation-ambiguity away from the
>> single "let mut x, y", which can be read either as "let mut" for x
>> and y, or "let mut x" and "let y"!
>> So imho "let mut" has at least two pitfalls:
>>         1) read-bump
>>         2) ambiguity.
>> AFAIK you did a remarkable good job so far, and i have all the faith
>> you are considering all arguments before coming to a decision.
>> Even if some thoughts of the thoughts come form the bad smelling
>> "lurker"-fraction, which do nothing but making comments about things they
>> possible can't understand! ;-)
>> Regards,
>> Don
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev at mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev

Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt
"If you are silent about your pain, they'll kill you and say you enjoyed it."
-- Zora Neale Hurston

More information about the Rust-dev mailing list