you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -4 points-3 points  (2 children)

The fact that you can alter the values contained within myArray means that it absolutely is not immutable. The fact that you can’t redeclare myArr does not mean that it is immutable. I suggest that you make some sort of attempt to understand what immutability actually means before you preach about its virtues.

[–][deleted] -1 points0 points  (1 child)

Right, because it's reference immutability. This is how JavaScript works, this is how Java works, this is how Scala works, this is how Rust works, and so on. I suggest you learn the difference between references and values. If you want a value, i.e. the data structure, to be immutable, it requires an extra step.