Nice writeup. Rust deals with the mutable part of this triple-whammy by adding mut syntax into the language to mark a binding as mutable.
In this way, all variables are immutable unless they are explicitely marked as mutable. Trying to modify an immutable variable will result in a compile-time error. It also has the added benefit of allowing the compiler to warn you if you've marked a variable as mutable unnecessarily.
I think this helps keep the thought of immutability in your mind when programming. It also allows another developer to know which parts of a program contain mutable state.
We’re a place for programmers to stay up-to-date, learn new skills, and share ideas.
We’ll never post without your permission.