Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!sunic!tut!tukki!sakkinen From: sakkinen@tukki.jyu.fi (Markku Sakkinen) Newsgroups: comp.object Subject: Re: Atomic Objects and Identity (was Re: Evaluating "Object-Oriented" Progra) Message-ID: <2919@tukki.jyu.fi> Date: 2 Feb 90 14:21:54 GMT References: <2740@tukki.jyu.fi> <1990Jan31.052750.22507@Neon.Stanford.EDU> Reply-To: sakkinen@jytko.jyu.fi (Markku Sakkinen) SAKKINEN@FINJYU.bitnet (alternative) Distribution: comp Organization: University of Jyvaskyla, Finland Lines: 84 I think this _is_ interesting. However, if this discussion becomes too dogmatic for most followers of the newsgroup, we might move it offline. In article <1990Jan31.052750.22507@Neon.Stanford.EDU> pallas@Neon.Stanford.EDU (Joe Pallas) writes: >A while ago we had some discussion about whether certain objects in >Smalltalk were ``first-class.'' It's taken me a while to organize my >thoughts on this, but I think there's still something to be gained by >further discussion. The focus here is on SmallIntegers. > >In article <2740@tukki.jyu.fi>, Markku Sakkinen wrote: > ... > Regarding Booleans, the fact that True and False need to be singleton > subclasses is an ugly wart that in my opinion shows a flaw in the > Smalltalk philosophy. > >I think this is an unusual view. Most people complain about the fact >that one-of-kind objects still need classes, but I've rarely heard >complaints about the existence of one-of-a-kind objects. In any >event, we have two interpretations that avoid one-of-a-kind objects. I did not want to complain about one-of-a-kind objects in general, but I think the Boolean values are "two-of-a-kind". One further thing in Smalltalk-80 that looks less than elegant to me really is the need for every class to have a metaclass of its own. > [claim by me that SmallIntegers are never created nor deleted, > conceptually] >I respectfully disagree here. There is nothing I can find in the >language definition that requires SmallIntegers to be unique. These >two views are equally valid. If one cannot _find_ some thing in the Smalltalk-80 bible, that's no guarantee that it isn't hidden there somewhere :-) I remember having read that even Symbols are guaranteed to be unique. You are right in that these viewpoints yield the same result: 1. SmallInteger objects are created and deleted as needed, but they cannot be compared by identity, only by value. 2. For each small integer value there is exactly one conceptual SmallInteger object, but it can be more expediently be referred to by value (and a tag bit that distinguishes this value from a reference). I only think that Smalltalk-80 prefers the latter viewpoint. > ... > illuminating classic, "Object Identity" by Khoshafian and Copeland > (ACM OOPSLA'86 Proceedings). > >This is an excellent paper, yes, but it neglects one point---namely, >why test identity? I claim there is only one reason to compare the >identity of two objects: to determine whether they can take on >different values. For immutable objects, identity tests are >pointless (except to do magic, as shown below). It does not neglect the point, because there is no such thing as an immutable object in the model of that paper. There is the crucial difference from the Smalltalk model that atoms are _values_, not objects, but there are also objects of atomic types - they are mutable. (You probably guessed which model I consider more logical.) I agree that one can rather well substitute equality for identity when comparing immutable objects. Of course, in the general case when they are not necessarily atomic, this holds only for "deep-immutable" or "transitively immutable" objects. (At least CLU defines non-atomic immutable objects, which may still point to mutable objects.) >Anyway, let's look at > > Three Interpretations of > SmallIntegers > >Considering mutability, uniqueness, equality, and ``degree of magic''. > ... That was nice. However, the very fact that you needed "a bit of magic" in all three interpretations reinforces my opinion that there is a fundamental glitch in the model. As far as I can see, Khoshafian and Copeland don't need any magic to interpret _their_ model. Markku Sakkinen Department of Computer Science University of Jyvaskyla (a's with umlauts) Seminaarinkatu 15 SF-40100 Jyvaskyla (umlauts again) Finland