[squeak-dev] Generator (was Re: The Trunk: System-ul.436.mcz)

Levente Uzonyi leves at elte.hu
Wed May 11 21:37:15 UTC 2011


On Tue, 10 May 2011, Bert Freudenberg wrote:

>
> On 10.05.2011, at 06:55, Levente Uzonyi wrote:
>
>> On Mon, 9 May 2011, Chris Muller wrote:
>>
>>> Uh oh, lookout!  Levente is pulling out the Generator!!  :-)
>>
>> I thought it's time to use it from a real method (one that's not a test for Generator). Btw it's not worth to use it there performance wise compared to creating a collection of the Behaviors, but it doesn't matter in this piece of code.
>
> For this use case it might be nice to have something simpler than a Generator. Instead of
>
> Generator on: [ :generator |
>    self allBehaviorsDo: [ :each |
>        generator yield: each ] ])
>
> we might want to write
>
>    CollectionMaker on: [:workBlock | self allBehaviorsDo: workBlock]
>
> CollectionMaker>>do: aBlock
>    ^doBlock value: aBlock
>
> This would be much less tricky than Generator, because no coroutines are needed in this case.

Right, but it's a one trick pony. I don't think it would see much use.


Levente

>
> - Bert -
>
>
>
>



More information about the Squeak-dev mailing list