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

Eric Summers eric.summers at me.com
Fri Jan 31 20:24:10 PST 2014

I’m new to Rust (three days), but I thought the mut syntax felt odd in a few places.  Type definitions in particular because it is one of the few places that require padding.  Is there any reason a symbol isn’t used for mutability instead?  Forgive me if I’m too naive in Rust.

With a symbol you can drop the space:
fn drop(&mut self) { .. } <-> fn drop(&!self)

The only other common situation I've seen so for that require the space are lifetime annotations.  Maybe there is an alternate form for those?

The symbol could probably be extended to let:
let mut a = 0; <-> let !a = 0; <-> let a: !u32 = 0;
or maybe mutable setter;
let a := 0;

As other said, I think ‘var' sugar feels against the design of the language.


More information about the Rust-dev mailing list