3 ms·
Because it's a bit too error-prone: mut listOfLeftHandedOralHygienistsInKazakhstan = getThem() // several lines later listOfLeftHandedOralHygienistsIn
by piaste 9y 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).
- RegW 9y ago... and whoops, the next thing you know your left handed oral hygienist has apocryphally crashed into Venus. https://en.wikipedia.org/wiki/Mariner_1 https://en.wikipedia.org/wiki/Mariner_1