home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.object
- Path: sparky!uunet!cs.utexas.edu!uwm.edu!linac!uchinews!alex!dave
- From: dave@alex.uchicago.edu (Dave Griffith)
- Subject: Re: Object hidden state and side effects
- Message-ID: <1992Dec20.162050.14652@midway.uchicago.edu>
- Sender: news@uchinews.uchicago.edu (News System)
- Organization: University of Chicago
- References: <BzF6uA.1u3@inews.Intel.COM> <1992Dec17.221333.3023@midway.uchicago.edu> <knight.724800436@cunews>
- Date: Sun, 20 Dec 1992 16:20:50 GMT
- Lines: 51
-
- In article <knight.724800436@cunews> knight@mrco.carleton.ca (Alan Knight) writes:
-
- >[Misattributes my stuff to Ben Bongalon, but I'll cope.]
- >
- >I can agree with most of this, but of course I have to add my two cents.
- >
- >I agree entirely with Ralph Johnson that adding just the ability to
- >distinguish values and objects is completely inadequate, and that a
- >more comprehensive approach to describing code semantics is required.
- >Given that you seem to be attempting to design a next-generation
- >language, by all means explore this.
-
- I'm on it.
-
- >
- >As far as the particular question of objects and values is concerned,
- >there are really two separate issues which I think are orthogonal: the
- >presence of an identity operation separate from equality and
- >mutability. We get four classes of things, which I'm going to call by
- >the names that have been used in this discussion, even if I don't
- >think they're entirely appropriate.
- >
-
- The problem is just what your expecting equality to do. If it's just
- another comparison, then all of the following make sense. If you also
- expect equality to satisfy "substituting equals for equals gives equals",
- things get more difficult. In that case, mutable objects pretty much must
- have equality as identity.
-
- >Mutable objects: Have an identity operation, can be modified.
- >The default case of objects.
- >
- >Immutable objects: Have no operations which modify state, but have an
- >identity operation. e.g. non-mutable strings
-
- Might be useful, although the need for an identity operation for non-mutable
- strings escapes me.
-
- >Values: Have no operations which modify state, have no identity
- >operation. e.g. numbers
- >
- >Normal storage (or mutable values): State can be modified, but there
- >is no identity operation. e.g. storage allocated on the stack in
- >traditional languages.
-
- 'Splain me, boss. I'm feeling dumber than usual.
-
- --
- Dave Griffith, Information Resources, University of Chicago,
- Department of Surgery dave@alex.bsd.uchicago.edu
- Become a sociopath. We don't even have to sweat the big stuff.
-