[squeak-dev] Generators in Smalltalk?

Ian Trudel ian.trudel at gmail.com
Wed Feb 10 05:40:23 UTC 2010

Hello Andreas,

I believe Timothy A. Budd has written a paper related to that,
entitled "The Generator Paradigm in Smalltalk" but I cannot find it
readily. He also wrote another paper entitled "An implementation of
generators in C". Isn't generators implemented in GNU Smalltalk?

Another implementation details are available in "The Implementation of
the Icon Programming Language", which is also in C. You can download
the book online at http://www.cs.arizona.edu/icon/books.htm


2010/2/10 Andreas Raab <andreas.raab at gmx.de>:
> Folks -
> One thing I really like about Python is Generators
> (http://docs.python.org/tutorial/classes.html#generators). They allow code
> to provide a stream (iterator) interface where it's not easy to provide the
> interface explicitly. I.e., it would allow one to provide a stream interface
> to an arbitrary computation like:
> gen := Generator on: [:yield| 3 to: 1 by: -1 do:[:i| yield value: i]].
> gen next. "=>3"
> gen next. "=>2"
> gen next. "=>1"
> gen next. "=>nil"
> This *ought* to be really simple to do in Smalltalk by using blocks and some
> voodoo in the execution engine. Has anyone ever done that?
> Cheers,
>  - Andreas


More information about the Squeak-dev mailing list