Apply vs. do (was: Re: join)
Klaus D. Witzel
klaus.witzel at cobss.com
Wed Sep 20 14:09:25 UTC 2006
On Wed, 20 Sep 2006 15:40:29 +0200, Bert Freudenberg wrote:
> Klaus D. Witzel wrote:
>> On Wed, 20 Sep 2006 01:21:57 +0200, Keith Hodges wrote:
>>> For example, using your logic, you would never come up with this idea.
>>> 1 to: 10 do: [:b ].
>>> I think your version might look like something from another thread on
>>> squeak-dev at the moment. ACollection>>from:to:apply:
>> And I thought that would slip through unnoticed ;-)
>> The original suggestion was, aBlock>>apply: aCollection from: start
>> to: stop.
>> Since only collections can know how to do that, aBlock and aCollection
>> had to be swapped. Of course your suggestion #from:to:apply: is also a
>> good one.
> I was wondering why it is called "apply" anyway - the traditional term
> would be "do". The only reason to call it "apply" is if it's a Block
> I'd suggest that the proper selector for that method would be
> which indeed exists already, and which would just get a speed
> enhancement by the new primitive.
Oh no! that's too easy! Only the one-liner <primitive: ...> has to be
added to an existing method. Will this count as an enhancement, a change,
a VM extension, or what ;-)
Thank you Bert.
> - Bert -
More information about the Squeak-dev