Double dispatch

Vassili Bykov vassili at objectpeople.com
Wed Nov 4 19:18:01 UTC 1998


At 09:35 AM 11/4/98 -0600, Lyn A Headley <laheadle at cs.uchicago.edu> wrote:
>
>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.

This is just a mix-up with terminology.  "Multiple dispatch" is a language
feature of looking up a method depending on the types of more than one
argument (so, in fact, there are no messages any more, the "driving force"
are generic functions, methods (that are parts of GFs), and method
combinations).  "Double dispatch" is an implementation technique used in
languages with single dispatch to implement multiple dispatch for the case
of two discriminating arguments.  Not confusing at all.

-- 
Vassili Bykov         vassili at objectpeople.com
The Object People     http://www.objectpeople.com
+1(613)225-8812
  "Any sufficiently complicated C or Fortran program contains an ad hoc
  informally-specified bug-ridden slow implementation of half of Common Lisp."
    -- Greenspun's Tenth Rule of Programming





More information about the Squeak-dev mailing list