Smalltalk and coroutines

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Smalltalk and coroutines

Delyan Kalchev
Hello!

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?

--
Delyan Kalchev
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk and coroutines

Lukas Renggli
> 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
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners