In article <firstname.lastname@example.org> Erik Naggum <email@example.com> writes:
> I have no idea whether Peter Ludemann had a third meaning of "object
> identity" in mind, and I don't know whether Andrew Koenig knows ML well
> enough that it is true that ML doesn't offer object identity, but it seems
> rather obvious to offer object identity if you offer composite types. what
> little I know about ML suggsts that ML _must_ offer object identity. (how
ML does not offer object identity, because it doen't have objects.
The closes it has is references, which are mutable cells that contain
values. Two references have the same value iff they are the same reference
(although two distinct references can contain the same value). Example:
val x = ref 3;
Now x is bound to a reference that contains the value 3.
val y = ref 3;
Now y is bound to a different reference that contains the value 3.
Therefore, x = x is true, x = y is false, and !x = !x and !x = !y are both true
(! is the dereferencing operator in ML).
If you do not references, values are all you have. So, for example
val p = [3, 4, 5];
val q = [3, 4, 5];
Now p = q because p and q have the same value, and there is no way to determine
whether p and q are the same list because even the question is meaningless in
(The implementation might store p and q as pointers to the same memory,
or it might not. There is no way to tell.)