[rust-dev] "let mut" <-> "var"
donquestion at rocketmail.com
Thu Jan 30 08:35:42 PST 2014
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
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.
"let mut x, 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:
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! ;-)
More information about the Rust-dev