home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / object / 4631 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.1 KB  |  46 lines

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