[Newbies] Smalltalk and coroutines

Lukas Renggli renggli at gmail.com
Wed Dec 3 18:51:51 UTC 2008


> According to this:
> http://en.wikipedia.org/wiki/Coroutine#Implementations_for_Smalltalk
> and other sources coroutines can be implemented in Smalltalk, but I've
> not had the chance to find a way to do it. Can you please help me, if
> you know how this can be done?

Have a look at the class ContextPart, especially the method
#swapSender:. thisContext is a special variable that returns the
current execution context, an instance of ContextPart.

You might also want to have a look at Seaside (www.seaside.st). It
comes with an implementation of Continuations in plain Smalltalk. This
is a bit more than what you are asking for, but it also uses
#swapSender: at some point to switch back to a previous execution
context.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the Beginners mailing list