rust-lang / rfcs

RFCs for changes to Rust
https://rust-lang.github.io/rfcs/
Apache License 2.0
5.9k stars 1.56k forks source link

`letm` as a syntactic sugar for `let mut` #3555

Closed abhijeetbhagat closed 8 months ago

abhijeetbhagat commented 9 months ago

i propose introducing a new keyword letm as a syntactic sugar for let mut. this saves 4 characters.

petar-dambovaliev commented 9 months ago

I don't think this is a good idea. There are many other places where you could save characters in the language. Rust already keeps a good balance of not writing too many characters but also not too few, so it's not a burden but also readable.

SOF3 commented 8 months ago

If typing it is an issue for you, you could propose autocompleting letm to let mut in code editors instead.

Also, there are many occurrences of mut for bindings (e.g. parameters, match, let Foo(mut field)) that you cannot save the character for, and possibly (citation needed) &mut is way more prevalent than let mut if you want to save characters somewhere.

scottmcm commented 8 months ago

Closing under https://lang-team.rust-lang.org/frequently-requested-changes.html#fundamental-changes-to-rust-syntax, which covers

These also include proposals to add "alternative" syntaxes,