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

  1. Newsgroups: comp.object
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!decwrl!amdcad!dvorak.amd.com!usenet
  3. From: mbehrens@barqs.amd.com (Mikael Behrens)
  4. Subject: Re: Equality
  5. Message-ID: <1992Dec22.162926.1324@dvorak.amd.com>
  6. Sender: usenet@dvorak.amd.com (Usenet News)
  7. Reply-To: mbehrens@ausun1.amd.com
  8. Organization: Advanced Micro Devices, Inc.; Austin, Texas
  9. References: <1992Dec21.184405.2215@midway.uchicago.edu>
  10. Distribution: usa
  11. Date: Tue, 22 Dec 92 16:29:26 GMT
  12. Lines: 39
  13.  
  14. In article <1992Dec21.184405.2215@midway.uchicago.edu> dave@alex.uchicago.edu  
  15. (Dave Griffith) writes:
  16. | So just what exactly do you all mean when you say "equality".  If it's just 
  17. | another binary predicate, why bother to call it equality?  If not, what 
  18. | semantic properties should it have?  The recent object/value discussion  
  19. brought
  20. | up some examples which cause me to question my preconceived notions.  I will
  21. | below attempt to list those notions, in hope the group will provide useful 
  22. | comments.   Throughout the following, "object" is used as in current OO 
  23. | languages, to represent both "objects" and "values".  
  24. | 1) Equality should be reflexive.  
  25. |     I thought this was obvious, but IEEE754 may provide a counterexample.
  26. | 2) Equality should be symettric.
  27. | 3) Equality should be transitive.
  28. | 4) Substitution of equals for equals should give equals.
  29. | 5) If two objects are equal at one point in program execution, they should  
  30. be
  31. |      equal at all points. 
  32. | 6) Assignment should respect equality.   (Assuming no side-effects, after 
  33. |    executing x:=a; it should be true that x=a.
  34. | 7) If your parameter passing model is based on assignment, 6) should hold 
  35. |    mutatis mutandi.
  36. | 8) If two objects are equal, they should be behaviourally indistinguishable. 
  37. |    The converse need not hold, but often will.
  38. | 9) Two sets A,B are equal iff  for_all(x:A)there_exists(y:B) such y=x, and
  39. |    vice versa.
  40. [rest deleted]
  41.  
  42. I've always assumed that (in a true object-oriented environment) if two  
  43. objects are equal, they are the same object.  Every unique object exists only  
  44. once in the system; but there may be multiple *references* to it.  This notion  
  45. of equality would agree with the above.  I don't know if any existing system  
  46. realizes this yet.  I only have experience with Smalltalk80, and I don't think  
  47. it prevents two instances of identical objects from existing simultaneously.
  48.  
  49. Mikael Behrens
  50. Advanced Micro Devices
  51.