Multiple dispatch (Re: [squeak-dev] The Inbox: Kernel-cmm.464.mcz)
Frank Shearar
frank.shearar at angband.za.org
Sun Jun 20 20:53:46 UTC 2010
On 2010/06/20 22:30, Frank Shearar wrote:
> On 2010/06/20 21:47, Brent Pinkney wrote:
>>> instead of the rather uglier
>> or, as it is used, the rather prettier:
>>
>> selector: things
>> "a single Thing, or a collection of Things."
>>
>> ^ thing asCollection inject: 0 into: [:total :n | total := total + n].
>
> Yes, that is _rather_ prettier than what I'd written! I'll remember this
> idiom.
>
> In which case, my argument in defence of #asArray isn't much of a
> defence at all.
I must be having a slow day or something. The idiom's nice & pretty...
and of course #asCollection doesn't exist. So what Chris is saying is
that this idiom is nice and pretty and we need Object>>asArray to make
it work.
frank
More information about the Squeak-dev
mailing list
|