[rust-dev] Why doesn't rust require "mut" param prefix at call site?
pcwalton at mozilla.com
Wed Jan 1 21:25:58 PST 2014
On 1/1/14 9:13 PM, Palmer Cox wrote:
> To me, this doesn't sound as much like a proposal for a change in syntax
> as a proposal to remove a bit of magic that Rust is currently doing. I
> don't know that I'm necessarily in favor or that though, since it would
> certainly make code more wordy. That wordiness might be nice, however,
> if it makes it clearer where variables might be mutated (eg: imagine
> that foo() is originally defined to take a & ,so bar() assumed that the
> variable won't be mutated. However foo() is later redefined to take a
> &mut which silently breaks bar()'s assumption about foo()).
That's a much more interesting question. I do worry about the verbosity
though, as you said.
In general I feel like we should either have autoborrowing in as many
places as reasonably possible or autoborrowing nowhere.
More information about the Rust-dev