Multiple dispatch (Re: [squeak-dev] The Inbox: Kernel-cmm.464.mcz)

Igor Stasenko siguctua at gmail.com
Sun Jun 20 16:32:19 UTC 2010


Best reference about multiple dispatch can be found in Slate language.

http://files.slatelanguage.org/doc/pmd/ecoop.pdf

in short, it is not about varargs but about looking up for a method
based on a set of behaviors(objects) of message arguments.

in smalltalk a lookup function takes two arguments:

F(selector ,  receiver class)

with multiple dispatch a lookup function can take any number of arguments:

F(selector ,  receiver, arg1 , arg2 .. )

so, effectively, if method is unary, then you have a single dispatch,
as in smalltalk, since
arguments count == 1 (receiver is implicit argument), and if there are
more than 1 argument,
then lookup function using properties of every or subset of message
arguments to find a method.

On 20 June 2010 17:38, Michael Haupt <mhaupt at gmail.com> wrote:
> Hi,
>
> On Sun, Jun 20, 2010 at 4:11 PM, Frank Shearar
> <frank.shearar at angband.za.org> wrote:
>>> Since Smalltalk does not support multi-methods, it is essential that the
>>> caller of a method can pass arguments in multiple formats to the same
>>> method and have them correctly interpreted by the implementation.
>> ...
>> (I assume you are talking about multiple dispatch - method lookup using not
>> just the receiver but also the types of the parameters to a selector, like
>> Common Lisp's generic functions?)
>
> looks more like varargs to me ...
>
> Best,
>
> Michael
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list