help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Dynamic Message Dispatch???


From: Krishna
Subject: Re: [Help-smalltalk] Dynamic Message Dispatch???
Date: Sun, 24 Jan 2010 15:43:24 +0530

On Sun, Jan 24, 2010 at 9:40 AM, Duke Normandin <address@hidden> wrote:
> Hello list...
>
> Still haven't been able to compile GST from git sources ;( but life
> goes one...
>
> Currently Reading Alan Lovejoy's "Smalltalk: Getting The Message
> The Essentials of Message-Oriented Programming with Smalltalk".
>
> I'm not grokking this paragraph:
>
> "Because of dynamic message dispatch, the semantics of sending a
> message to an object depend absolutely on the object that receives the
> message. The same message may be interpreted quite differently by
> different objects, due to the fact that each object may use a
> different method namespace in order to lookup a method based on the
> selector of a message, and so may associate a different method with
> the same message selector. Consequently, a message can be thought of
> as an abstract function call which will result in the execution of
> whatever concrete function (subroutine) is chosen by the object that
> receives the message. The idea is that a message should name the
> logical function to be computed, but the object receiving the message
> should decide how best to physically compute the desired result. The
> universal, pervasive application of this distinction between logical
> function (semantics) and physical function (implementation strategy)
> is the central point of object oriented programming, as defined and
> envisioned by Dr. Kay."
>
> Would one of you fine Smalltalkers explain the above in plain language
> - 1 or 2 sentences would be good. I'm assuming that I _need_ to
> understand what dynamic message dispatch means and how it works before
> I can proceed intelligently. TIA...

I'm no smalltalker but anyway here is my understanding:

dynamic message dispatch means that the receiver of a message is
*always* determined at runtime and unlike other (static) languages,
the message dispatch mechanism is more than a syntactic shortcut for
calling functions with the right parameters. You can build message
"selectors" and "perform" your own dispatches if you want to. Messages
are not coupled with objects. A message can be sent to any object and
if the object "doesNotUnderstand" then you still get a chance to
handle the unexpected situation.

cheers,
  --krishna

-- 
I long to accomplish a great and noble task, but it is my chief duty
to accomplish small tasks as if they were great and noble !
  -- Helen Keller




reply via email to

[Prev in Thread] Current Thread [Next in Thread]