Path: utzoo!attcan!uunet!husc6!bloom-beacon!clyde!concour!marcap From: marcap@concour.CS.Concordia.CA (Marc Pawlowsky) Newsgroups: comp.lang.eiffel Subject: PEEVES Message-ID: <882@clyde.Concordia.CA> Date: 8 Jun 89 18:34:13 GMT Sender: news@Clyde.Concordia.CA Reply-To: marcap@concour.CS.Concordia.CA (Marc Pawlowsky) Organization: Concordia University, Montreal Quebec Lines: 41 >Please repost this to comp.lang.eiffel for me. Our news posting >software has been broken for a long time and I don't know when it will >be fixed. Please reply to author not me. Subject: pet peeves re := and deepCopy Summary: neither problem is real Reply-To: deutsch@parcplace.com (L. Peter Deutsch) Organization: ParcPlace Systems, Mountain View, CA 1) Re the "inconsistency" of :=. You are confusing the notions of identity, primitiveness, and equality. For immutable objects (such as numbers and characters), regardless of whether they enjoy special implementation, an argument can be made that "identity" is not a useful concept, since two immutable objects with the same contents will behave the same under all circumstances. If you decide that in your language every object has a hidden, immutable piece of state called its "identity", well and good, but then you have to pay a very heavy performance price (you have to leave enough room in every object, even integers, for this unique "identity"). I believe a better approach is to take the point of view that the "identity" of an immutable object is a function of its contents, i.e., that immutable objects with the same (client-visible) contents really cannot be distinguished. This has nothing to do with whether the object is "primitive". As a consequence, whether := copies an immutable object or not becomes entirely a matter of implementation with no semantic consequences. 2) deepCopy is not a semantically useful notion. Where do you stop? Do you copy classes as well as contents? If an object has a reference to some widely shared data structure, do you copy that entire structure? What about references to objects like Symbols (in Smalltalk), where there is an invariant requiring unique representation of Symbols with the same contents? I believe providing a deepCopy operation is a mistake. If it were up to me, it would be removed from the Smalltalk-80 system. L. Peter Deutsch