RIFE has gathered a lot of interest lately, and a lot thanks to its pure Java continuations engine. For quite some time I have been planning to extract the continuations support into a dedicated library, but never got around to doing so due to time constraints.

About a week ago I was approached by Patrick Lightbody who wanted to help out with this task so that WebWork could provide continuations too. A few days later we had a first prototype running and it has already been integrated in the recent release of WebWork 2.2 beta2.

Currently this is almost a straight extraction from the RIFE sources and it still needs a lot of love and cleaning up to make it truly general-purpose.

If you're interested in helping out, you can find more information on the RIFE/Continuations project page. Note that sub-project it is still very experimental, but that the engine itself has been stable inside RIFE for years. Quite some people have approached me about this in the past, so I thought it would be good to already announce the effort. When a lot of eyes look at it, I'm sure we'll come up with a much better API.

Very interesting project. This has the potential of greatly simplifying iterator implementations: for example, iterating over a tree is very simple as long as one can use recursive method calls. With continuations it is easy to turn such an ensemble into an iterator: after you have retrieved the next value, return it and pause at the same time; re-invoke the continuation every time you want another element. Python uses "generators" for mainly this purpose: http://www.python.org/doc/2.2.3/whatsnew/node5.html

Has there been given any thought to this kind of application of the RIFE/Continuations API? "Java-fying" any of the Python generator articles would probably make great reading.