Article View: comp.lang.java
Article #19Re: Are "super" and "this" different objects?
From: Piercarlo Grandi
Date: Wed, 25 Oct 1995 20:38
Date: Wed, 25 Oct 1995 20:38
45 lines
2606 bytes
2606 bytes
>>> On Mon, 23 Oct 1995 15:44:42 GMT, shang@corp.mot.com (David >>> L. Shang) said: David> C++ and SmallTalk uses a different inheritance mechanism. Amazing news from America once again... David> In SmallTalk, the member defined in superclasses actually exists David> in superclass. SmallTalk uses dynamic inheritance, Are you sure? This seems to make little sense to me. As far as any user/implementor of Smalltalk knows, an object is a single entity, not a collection of entities, as many as there are classes in the prefix chain. David> therefore, "this" and "super" are different objects. No, no, no, no. I read on page 37 of "A little Smalltalk", a slim introductory level textbook by T. Budd: "Both the [pseudo] variables 'self' and 'super' refer to the receiver of the current message. When a message is passed to 'self' the search for a method [ ... ] On the other hand, when a messag eis passed to 'super', the search begins with [ ... ]' In other words, in Smalltalk 'self == super' is true by definition, and it is only method lookup that differs. The different behaviour is possible because the Smalltalk compiler understands 'self' and 'super' to be pseudo-variables, and thus treats them specially. David> In C++, there shouldn't be a distinction of objects: an object of David> subclass and an object of superclass. It is a single object David> viewing in different types: in the superclass and in the David> subclass. Exactly like in Smalltalk... BTW, you are the second person in a day to display a gross misunderstanding of Smalltalk fundamentals -- and this is not by chance, or your fault alone. One of the big problems with Smalltalk is the extremely misleading termonology used therein, e.g. 'message' for 'procedure' and 'sending' for 'calling'. As D. Hopwood reminded me once, no amount of pithy verbiage will remedy conceptual pitfalls, but I can try :-), even with languages where the terminology does mislead.
Technical Details
Message-ID:
<vwjbur5e1td.fsf@osfb.aber.ac.uk>Path:
arc1-ca.pugleaf.net!io.salford.ac.uk!aber!innewsReferences:
<1995Oct23.154442.6836@schbbs.mot.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!io.salford.ac.uk!aber!innews From: pcg@aber.ac.uk (Piercarlo Grandi) Newsgroups: comp.lang.java,comp.object,comp.lang.c++ Subject: Re: Are "super" and "this" different objects? Date: 25 Oct 1995 20:38:38 +0000 Organization: Prifysgol Cymru, Aberystwyth Sender: pcg@osfb.aber.ac.uk Message-ID: <vwjbur5e1td.fsf@osfb.aber.ac.uk> References: <1995Oct23.154442.6836@schbbs.mot.com> Reply-To: pcg@aber.ac.uk (Piercarlo Grandi) NNTP-Posting-Host: osfb.aber.ac.uk In-reply-to: shang@corp.mot.com's message of Mon, 23 Oct 1995 15:44:42 GMT Precedence: first-class X-Newsreader: Gnus v5.0.4