home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.object
- Path: sparky!uunet!elroy.jpl.nasa.gov!decwrl!amdcad!dvorak.amd.com!usenet
- From: mbehrens@barqs.amd.com (Mikael Behrens)
- Subject: Re: Equality
- Message-ID: <1992Dec22.162926.1324@dvorak.amd.com>
- Sender: usenet@dvorak.amd.com (Usenet News)
- Reply-To: mbehrens@ausun1.amd.com
- Organization: Advanced Micro Devices, Inc.; Austin, Texas
- References: <1992Dec21.184405.2215@midway.uchicago.edu>
- Distribution: usa
- Date: Tue, 22 Dec 92 16:29:26 GMT
- Lines: 39
-
- In article <1992Dec21.184405.2215@midway.uchicago.edu> dave@alex.uchicago.edu
- (Dave Griffith) writes:
- | So just what exactly do you all mean when you say "equality". If it's just
- | another binary predicate, why bother to call it equality? If not, what
- | semantic properties should it have? The recent object/value discussion
- brought
- | up some examples which cause me to question my preconceived notions. I will
- | below attempt to list those notions, in hope the group will provide useful
- | comments. Throughout the following, "object" is used as in current OO
- | languages, to represent both "objects" and "values".
- |
- | 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.
- [rest deleted]
-
- I've always assumed that (in a true object-oriented environment) if two
- objects are equal, they are the same object. Every unique object exists only
- once in the system; but there may be multiple *references* to it. This notion
- of equality would agree with the above. I don't know if any existing system
- realizes this yet. I only have experience with Smalltalk80, and I don't think
- it prevents two instances of identical objects from existing simultaneously.
-
- Mikael Behrens
- Advanced Micro Devices
-