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

  1. Newsgroups: comp.object
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!alex!dave
  3. From: dave@alex.uchicago.edu (Dave Griffith)
  4. Subject: Re: Equality
  5. Message-ID: <1992Dec22.183803.16421@midway.uchicago.edu>
  6. Sender: news@uchinews.uchicago.edu (News System)
  7. Organization: University of Chicago
  8. References: <1992Dec21.184405.2215@midway.uchicago.edu> <BzoAD8.By6@newsflash.concordia.ca>
  9. Date: Tue, 22 Dec 1992 18:38:03 GMT
  10. Lines: 49
  11.  
  12. In article <BzoAD8.By6@newsflash.concordia.ca> grogono@cs.concordia.ca (Peter Grogono) writes:
  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.  
  47. Arrgh, another case of typing before thinking on my part.  I was thinking
  48. in terms of relations and trying to come up with a way of expressing what I 
  49. need.  I failed. For all of the above to hold for set objects, they must be 
  50. immutable anyway (#5 and #8, as well as the basic mathematical idea of set), 
  51. and I've never expressed any disagreement with user-defined equality for 
  52. immutable objects.  If you want to test mutable "sets" to see whether they 
  53. have the same members, but I'm not sure with calling such a test equality,
  54. unless equality is just another binary predicate.
  55.  
  56.  
  57. -- 
  58. Dave Griffith, Information Resources, University of Chicago,
  59. Department of Surgery                       dave@alex.bsd.uchicago.edu
  60. A man's best friend is his dogma.
  61.