Luc asks:
> Pardon my ignorance, Steve, but what do you mean by mutable?
Allowed to change -- the inverse of constant. Most variables in Pop
are updated more than once in their dynamic lifetime and are therefore
intrisincally mutable. Some variables are allowed to change but provably
are never assigned to more than once -- they are potentially mutable but
can be treated as immutable (i.e. constant).
There is an ambiguity over whether (im)mutability just applies to the top-
level of a datastructure or all levels. e.g. If I write
constant foo = {'dog'};
then the variable foo is immutable -- it always points to the same
location. However, its value is mutable. i.e.
'cat' -> foo(1);
is legal and changes the value of foo. So the question is whether it is
really proper to talk of foo being immutable when it value can change? In
Pop, it turns out that the best way to use the term immutable is to only
be concerned with the top-level. This is because there are so few data
structures in Pop which are non-assignable, the other usage would never
apply.
Hope this helps!
Steve
|