In article <E9AxB1.7nA@ecf.toronto.edu>,
Patrick Doyle <doylep@ecf.toronto.edu> wrote:
>
>I think if a language has the concept of mutability, then it should also
>have the concept of object identity because both the cases presented in
>the previous paragraph are very useful in different curcumstances.
>
>Of course if a language has no mutability, then object identity is
>unnecessary.
I'm not sure that even the latter is right. It seems to me that it
can be reasonable to use object identity to represent conceptual-level
identities, even in purely functional programs.
This isn't to say that FP langauge designers are unreasonable when
they make no-object-ID's the default in pure functional languages. It
just doesn't seem like a necessary connection. If you want to
encode the fact that two conceptual entities are known to be the
same entity, you can ensure that the corresponding object identities
are the same. (Like the use of symbols in Scheme, which are
different from Lisp symbols in that they have no state whatesoever.
Still, the fact that they're unique is what makes them really useful
and different from strings.) Conversely, if you want to represent
the fact that two conceptual objects are not known to be the same object,
you can use different language-level objects to encode that.
--
| Paul R. Wilson, Comp. Sci. Dept., U of Texas @ Austin (wilson@cs.utexas.edu)
| Papers on memory allocators, garbage collection, memory hierarchies,
| persistence and Scheme interpreters and compilers available via ftp from
| ftp.cs.utexas.edu, in pub/garbage (or http://www.cs.utexas.edu/users/wilson/)
|