🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java
Article #32

Re: Are "super" and "this" different objects?

#32
From: Piercarlo Grandi
Date: Fri, 03 Nov 1995 19:21
57 lines
3614 bytes
>>> On 3 Nov 1995 10:44:51 GMT, mklein@alumni.caltech.edu (Michael
>>> S. Klein) said:

Michael> pcg@aber.ac.uk (Piercarlo Grandi) writes:

pcg> Also, in a previous article, I had written that in Smalltalk,
pcg> confusingly, procedure == message and calling == sending, where I
pcg> had omitted 'call' as in 'procedure call == message'. Thanks to
pcg> someone that wrote me noting this. Incidentally, I find the
pcg> Smalltalk 'method' for 'procedure' not confusing; but surely the
pcg> idea of 'sending' a 'message' to an object is even more bizarre
pcg> when the alternative of 'invoking a method' is available.

Michael> Sending a message does, indeed, invoke a method.

In the current Smalltalk terminology, the method is invoked as a
consequence of 'sending a message'. But please note that I was making
the point that a _different terminology_, less confusingly dissimilar
from that used for other languages, should be used, for what happens in
Smalltalk is exactly the same as what happens in other languages, and
using a different terminology makes some people (and we have seen the
very phenonemon in this thread) mistakenly believe that there is also
different semantics behind it.

In more conventional languages, one usually speaks of 'calling a
procedure' instead of 'sending a message', and of procedure interface
instead of selector and procedure body instead of method. Often, and
this was I used it in the above paragraph, 'method' is used to denote a
procedure (not just its body) that belongs to a class, to emphasize the
fact it is not standalone; I personally like better 'method' than
'member function', in effect.

When a procedure name/interface is overloaded (member procedures are
overloaded on their first implicit parameter), resolving the name of the
procedure into (a reference to) its body is not as straightforward as
without overloading (without overloading one looks up the name and
checks the signature, with overloading one looks up both the name and
the signature parts of a procedure's interface):

Michael> But when you write the code that sends the message, you don't
Michael> know *which* method it will invoke.

So what? If you use the Smalltalk terminology (method == procedure
block), this is nothing special: many languages associate multiple
implementation with one name. I prefer to speak of 'method' as in "the
addTo: method' (that is procedure, whereas that is the selector in
Smalltalk's original lingo), and then you know which method you have
invoked, 'addTo:', just not which implementation (note that a single
procedure might have multiple implementations that are semantically
equivalent, but that are pragmatically different, unfortunatley few
languages support the idea).

Michael> That's polymorphism.

I am already on record as saying that "polymorphism" is such a flexibly
defined word that it had better be forgotten. Yours is just one of a
million definitions.
Technical Details
Message-ID: <vwjbuqta4hr.fsf@osfb.aber.ac.uk>
Path: arc1-ca.pugleaf.net!bath.ac.uk!aber!innews
References: <1995Oct23.154442.6836@schbbs.mot.com> <47crr3$f5a@gap.cco.caltech.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bath.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: 03 Nov 1995 19:21:36 +0000
Organization: Prifysgol Cymru, Aberystwyth
Sender: pcg@osfb.aber.ac.uk
Message-ID: <vwjbuqta4hr.fsf@osfb.aber.ac.uk>
References: <1995Oct23.154442.6836@schbbs.mot.com>
 <47crr3$f5a@gap.cco.caltech.edu>
Reply-To: pcg@aber.ac.uk (Piercarlo Grandi)
NNTP-Posting-Host: osfb.aber.ac.uk
In-reply-to: mklein@alumni.caltech.edu's message of 3 Nov 1995 10:44:51 GMT
Precedence: first-class
X-Newsreader: Gnus v5.0.4