5 ms·
Makes sense, but my brain fires wrong visual signals when I see "mut". If the whole point is to name a memory address - mutable or immutable. Why not have a sp
by crudbug 11y ago
Makes sense, but my brain fires wrong visual signals when I see "mut".
If the whole point is to name a memory address - mutable or immutable. Why not have a special name for the address itself ?
e.g: a = immutable, #a = mutable.
- simias 11y agoThat would make refactoring painful I suppose and it's unlike anything in the language. In general the rust devs have tried to get rid of as many sigils as possible anyway so your proposal is very unlikely to gain traction.
- crudbug 11y agoI know, just a suggestion. I should design an "uber-lang" to sit on top of JVM / CLR / LuaJIT / Rust ! :)
- steego 11y agoYour brain should fire wrong signals when you see mut. I think part of the design of mut is to discourage you from abusing mutable variables. (Personally, I prefer F# forcing you the type mutable). I'm glad they didn't give it a special prefix because not only would it add unnecessary noise, it would make refactoring tedious. I'd rather give the compiler my intent once, and let it figure out if I violated my own intentions. One thing I like in the F# toolset is the syntax highlighters will highlight mutable and reference variables different colors. It's a matter of time before Rust developers have that (If they don't already).
- crudbug 11y ago"Discouraging Mutability" with the added "mut" would be a positive way to look at it. Thanks !