One thing I don't really get about that "immutability makes variables safer in Rust".
Say I do
let x = 5;
and then
x = 6;
Won't work. Cool. Variable is safe.
... until I shadow it like so:
let x = 6;
I dunno - maybe I'm not seeing it, but doesn't that kinda defeat the purpose?
I feel I am much more likely to create a bug by accidentally shadowing a variable I forgot about than changing something I specifically declared immutable...
@memoriesin8bit I love this kind of shadowing. Along with drop, it really limits a variable's true lifetime, so it's harder to make the kind of bug where you changed it and forgot that you've done so.
Which happens far too often in the disgusting C codebases I had the misfortune of working in, is exactly Rust's primary target audience.