home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!europa.asd.contel.com!howland.reston.ans.net!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!olivea!charnel!sifon!newsflash.concordia.ca!grogono
- From: grogono@cs.concordia.ca (Peter Grogono)
- Newsgroups: comp.object
- Subject: Re: Object hidden state and side effects
- Message-ID: <BzMo4u.791@newsflash.concordia.ca>
- Date: 21 Dec 92 21:10:06 GMT
- References: <1992Dec16.65250.10645@kei.is.s.u-tokyo.ac.jp> <1992Dec16.175126.14968@midway.uchicago.edu> <BzIFGp.K7@cs.uiuc.edu>
- Sender: usenet@newsflash.concordia.ca (USENET News System)
- Organization: Computer Science, Concordia University, Montreal, Quebec
- Lines: 31
- Nntp-Posting-Host: concour.cs.concordia.ca
-
- In article <BzIFGp.K7@cs.uiuc.edu> johnson@cs.uiuc.edu (Ralph Johnson) writes:
- >The difference between an "object" and a "value" seems to be that for
- >a value, equality can be implemented by bit comparison of the things,
- >while objects can only use identity of addresses in memory or else
- >require a user-supplied function. Isn't this just a result of immutability?
-
- This is misleading because equality is (almost) orthogonal to the
- object/value distinction. Graphs, with edges represented by pointers,
- may be values, but you would not want to compare them bit-by-bit in
- an equality test, because "equality" in this case should mean
- "isomorphic" for most applications.
-
- I agree that objects are "equal" (actually "identical") if they have
- the same address, and that this is often a useful test.
-
- The underlying problem is the difference between intensions and
- extensions. As a general rule, we compute with intensions but we
- want to compare extensions. The strings "2+2" and "1+3" have the
- same extensional value, under a suitable interpretation, but are not
- equal strings. If we convert them to the integers 4 and 4, we achieve
- equality, but that is mere good fortune, because we are
- still working with intensions (or representations). The whole point
- of semantic theories is to show that we can obtain correct
- extensional results while working with intensions.
-
- IMHO, there is no suitable default for equality in an OO language.
- The language should provide a few simple tests, such as bit
- comparison and pointer comparison, but it is the responsibility of
- each class to provide a criterion for equality of its instances.
-
- Peter
-