[squeak-dev] Re: Generators in Smalltalk?

Martin Kuball martinkuball at web.de
Mon Feb 15 15:11:01 UTC 2010


Am Thursday 11 February 2010 schrieb Andreas Raab:
> Lukas Renggli wrote:
> > I've fixed that. There could be more bugs, as I've never used them
> > beyond the anecdotical examples showing off runtime reflection.
> 
> I uploaded a version that fixes two more issues, one affecting the use 
> of reset and unwind blocks and one that affected error handling in 
> Generators. If people want to try this, you can install:
> 
> Installer installUrl:
> 'http://source.lukas-renggli.ch/continuations/Generator-ar.5.mcz'
> 
> and check it out. To me this looks pretty damn ready for use, if I hear 
> no strong objections be prepared to find this merged into the 
> Collections package Real Soon Now.
> 
> Cheers,
>    - Andreas
> 

Andreas,

this generator stuff is really cool. It helped me find a solution to a problem I have using a coroutine.
I couldn't  use a generator because in my case the producer is the one controling the process,
So I build my own version of a coroutine following your Generator class.

While studying your code I stumbled upon "[self fork] value" in method reset. Question is, why the block here? wouldn't self fork suffice?

And while comparing with the class from Stephen Pair I asked myself why you didn't implement a finalize methode. Or rather why Stephen tought it necessary to do so.

Would be nice if you could shed some more light on this.

Martin



More information about the Squeak-dev mailing list