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

Frank Shearar frank.shearar at angband.za.org
Sun Jun 20 14:11:04 UTC 2010


On 2010/06/20 15:16, Brent Pinkney wrote:
> Hi,
>
>> maybe #inArray or #asSingleton would be more appropriate: it is not a
>> conversion, it is an encapsulation.
>
> Nope, Chris is right. #asArray (and #asCollection) belong in Object and add a
> lot to promoting terseness in Squeak.
>
> 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.

Smalltalk _can_ support multimethods - Foote/Noble/Johnson's work shows 
how (http://www.laputan.org/reflection/ecoop-multimethods.pdf) - we just 
don't make use of the feature.

(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?)

> Remember- the computer works for the user, not the other way around.
>
> For those interested in a pattern, the Chronology implementation uses
> #asDateAndTime gratuitously , for similar _significant_ improvements in
> terseness and readability.
>
> I find it deeply offensive when using String>>#format: to _have_ to  make and
> pass an array when my string only has one {1} subsctitution field. Silly little
> languages like C# allow multi-methods.

Do you have a reference for the C# part? I see a claim on Wikipedia 
pointing to a page that doesn't talk about multiple dispatch, and the 
"New Features in C# 4.0" on 
http://code.msdn.microsoft.com/cs2010samples/Release/ProjectReleases.aspx?ReleaseId=1686 
also doesn't demonstrate (as far as I can see) multiple dispatch.



More information about the Squeak-dev mailing list