in reply to Re^11: The fallacy of the *requirement* for read-only instance variables.
in thread The fallacy of the *requirement* for read-only instance variables.

Ah, so, number are immutable because the literals are, and string are mutable because variables holding the strings are.

Right.

Maybe it would have been better if I had talked about hashes being mutable and numbers being immutable.
Same problem.

You're only able to modify a hash by stuffing it into a variable - but once you do that, numbers are mutable as well.

Anything that can appear on the LHS of an assignment is mutable (although the reverse doesn't automatically follow). Now, one can argue that there are no hash literals (they're either lists, or hashrefs), but that invalidate my arguments.

  • Comment on Re^12: The fallacy of the *requirement* for read-only instance variables.