home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.object
- Path: sparky!uunet!newsflash.concordia.ca!grogono
- From: grogono@cs.concordia.ca (Peter Grogono)
- Subject: Re: Equality
- Message-ID: <BzoAD8.By6@newsflash.concordia.ca>
- Sender: usenet@newsflash.concordia.ca (USENET News System)
- Nntp-Posting-Host: cyclops.cs.concordia.ca
- Organization: Computer Science, Concordia University, Montreal, Quebec
- References: <1992Dec21.184405.2215@midway.uchicago.edu>
- Date: Tue, 22 Dec 1992 18:07:55 GMT
- Lines: 33
-
- In article <1992Dec21.184405.2215@midway.uchicago.edu> dave@alex.uchicago.edu (Dave Griffith) writes:
- > .......
- >1) Equality should be reflexive.
- > I thought this was obvious, but IEEE754 may provide a counterexample.
- >
- >2) Equality should be symettric.
- >3) Equality should be transitive.
- >4) Substitution of equals for equals should give equals.
- >5) If two objects are equal at one point in program execution, they should be
- > equal at all points.
- >6) Assignment should respect equality. (Assuming no side-effects, after
- > executing x:=a; it should be true that x=a.
- >7) If your parameter passing model is based on assignment, 6) should hold
- > mutatis mutandi.
- >8) If two objects are equal, they should be behaviourally indistinguishable.
- > The converse need not hold, but often will.
- >9) Two sets A,B are equal iff for_all(x:A)there_exists(y:B) such y=x, and
- > vice versa.
- >
- >Given mutable objects, identity was the only practical definition I found
- >which would support all of the above. However, identity is not a practical
- >equality definition for all objects we wish to program with (vis, integers).
- >In these cases, if immutability holds, users may be able to define equality
- >in ways which satisfy the above, and there are good reasons to let them try.
-
- I do not see how "identity" supports #9. In principle, A=B, where A and
- B are sets, should mean that A and B have the same members, even if the
- representations of A and B are distinct in memory and may be different
- data structures. I do not see how an equality test of this kind can be
- built-in to a language, and this was my reason for saying that equality
- must be user-defined in general.
-
- Peter
-