home *** CD-ROM | disk | FTP | other *** search
- From: sfk@otter.hpl.hp.com (Steve Knight)
- Date: Mon, 25 Jan 1993 12:02:32 GMT
- Subject: Re: Re: dlocals etc. (and shallow binding)
- Message-ID: <116670051@otter.hpl.hp.com>
- Organization: Hewlett-Packard Laboratories, Bristol, UK.
- Path: sparky!uunet!usc!sdd.hp.com!hpscit.sc.hp.com!hplextra!otter.hpl.hp.com!otter!sfk
- Newsgroups: comp.lang.pop
- References: <C1CAwq.8up@cs.bham.ac.uk>
- Lines: 26
-
- 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
-
-