Multiple Dispatch

Joel Shellman joel at ikestrel.com
Sun Jun 15 06:46:38 UTC 2003


I'm familiar with double dispatch, I was asking about multiple dispatch (of
which double dispatch is a subset), so I'll take that as a no.

Thanks,

-joel

----- Original Message ----- 
From: "Stephane Ducasse" <ducasse at iam.unibe.ch>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Saturday, June 14, 2003 12:58 PM
Subject: Re: Multiple Dispatch


> Double-dispatch pattern
>
> I do not have a link at hand. Try google. It is used in Smalltalk to
> define automatic coercion for number. I looked into Squeak but the code
> on Integer, Float is a bit more complex and does not show the essence
> of the pattern.
>
> Look in my slides at:
> http://www.iam.unibe.ch/~ducasse/Web/Lectures/Lectures-OOP-0203/
>
> Stef
>
>
> On Saturday, June 14, 2003, at 08:25 PM, Joel Shellman wrote:
>
> > Has someone put in something to squeak to allow multiple dispatch? I
> > thought
> > I heard this was not supported in Smalltalk in general, but is there
> > something in Squeak to do it?
> >
> > Thanks!
> >
> > -joel
> >
> >
> >
> > ----- Original Message -----
> > From: "Brian T Rice" <water at tunes.org>
> > To: "The general-purpose Squeak developers list"
> > <squeak-dev at lists.squeakfoundation.org>
> > Sent: Monday, June 09, 2003 2:04 AM
> > Subject: Re: Object: Identity vs. Environment
> >
> >
> >> I'm glad that someone eventually mentioned something related to
> >> multiple
> >> dispatch. Slate's is: seems to work rather well for this case. ;)
> >>
> >> You can also override is: for ad hoc pretending on a pair of
> >> arguments,
> >> and the original method is reallyIs: and is not overridden.
> >>
> >> On Mon, 9 Jun 2003, Joel Shellman wrote:
> >>
> >>> Ah, I think what you're referring to is double dispatch, isn't it?
> >>>
> >>> http://c2.com/cgi/wiki?DoubleDispatch
> >>>
> >>> Which so far as I understand it makes good sense.
> >>>
> >>> -joel
> >>>
> >>> ----- Original Message -----
> >>> From: "Andres Valloud" <sqrmax at comcast.net>
> >>> To: "The general-purpose Squeak developers list"
> >>> <squeak-dev at lists.squeakfoundation.org>
> >>> Sent: Monday, June 09, 2003 12:04 AM
> >>> Subject: Re: Object: Identity vs. Environment
> >>>
> >>>
> >>>>> But you might have a dozen methods with isFoo + ifTrue/ifFalse.
> >>>>> Then you would need Object>>fooAction1, Object>>fooAction2, etc.
> >>>>
> >>>> The dozen actions will get written one way or the other, either
> >>>> inside
> >>>> ifTrue/ifFalse blocks or in messages.  As far as the amount of code
> >>>> is
> >>>> concerned, fooActions are at least as compact - if not more since
> >>>> you
> >>>> don't need ifTrue/ifFalse.
> >>>>
> >>>> The key issue here is that the ifTrue/ifFalse actions should be in
> >>>> messages the receivers of isXYZ understand.  Otherwise, the context
> >>>> in
> >>>> which you write the ifTrue/ifFalse actions has to grow larger to
> > provide
> >>>> meaning to the actions.  You end up as if you had used a traditional
> >>>> programming language: the receivers of isXYZ are more value holders
> > than
> >>>> behaviorful distinctions as far as the context of usage is
> >>>> concerned.
> >>>>
> >>>> Disclaimer: these arguments apply only to the "isKindOf:" kind of
> > isXYZ
> >>>> messages.
> >>>>
> >>>> Andres.
> >>
> >> -- 
> >> Brian T. Rice
> >> LOGOS Research and Development
> >> http://tunes.org/~water/
> >>
> >
> >
>
>



More information about the Squeak-dev mailing list