Apply vs. do (was: Re: join)

Bert Freudenberg bert at freudenbergs.de
Wed Sep 20 13:40:29 UTC 2006


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 method.

I'd suggest that the proper selector for that method would be

	from:to:do:

which indeed exists already, and which would just get a speed 
enhancement by the new primitive.

- Bert -



More information about the Squeak-dev mailing list