Double dispatch

Lyn A Headley laheadle at cs.uchicago.edu
Wed Nov 4 15:35:35 UTC 1998


>>>>> "L" == L M Rappaport <rapp at lmr.com> writes:

[snip double dispatch is delegation]

    L> This is double dispatch - when you call Documents foreground
    L> color, it instead goes to its instance variable and dispatches
    L> the method there.  Now granted this is a lot of trouble to go

[snip]

    L> Hope this clears it up.  OTOH, if I'm full of crap, I'm sure
    L> someone will mention it!

I'm afraid I must speak up here.  I believe you are confusing
delegation with double dispatch.  The way I understand it is that
double-dispatch is a *language* feature which looks up the method to
call based on the runtime type/class of *two* of its arguments rather
than simply the first as is the case with most OO languages.  when I
say argument I really mean the object to which the message is sent,
but multi-dispatch languages usually use generic messages so the
object really *is* an argument to the method.

confusing, huh?  see Common lisp's CLOS for an example.


-Lyn





More information about the Squeak-dev mailing list