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

Steven Fackler sfackler at gmail.com
Thu Jan 30 08:49:28 PST 2014


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140130/2e28b8ab/attachment.html>


More information about the Rust-dev mailing list