|
|
|
|
|
by piaste
3323 days ago
|
|
Because it's a bit too error-prone: mut listOfLeftHandedOralHygienistsInKazakhstan = getThem()
// several lines later
listOfLeftHandedOralHygienistsInKazahkstan = getThemAgain()
You thought you were reassigning the mutable variable, but you actually created a different immutable variable.This can be prevented by having different operators for assignment and re-assignment. Some languages do that: in OCaml / F#, re-assignments use '<-' while declarations use 'let (mutable) x =' (they can't drop the 'let' because they use '=' as the Boolean equality operator). |
|
https://en.wikipedia.org/wiki/Mariner_1