Prototyping continuations in IronRuby

Posted at Wed, 31 May 2006 15:34:25 GMT by Wilco Bauwer

There are a lot of interesting discussions going on about continuations. Some of the articles/posts I came across are:

Since the day I released the first preview of IronRuby I've had questions about support for continuations in IronRuby. It's not trivial at all to get the implementation right (without breaking anything). Additionally, very few people seem to really grok continuations. The 'killer app' for continuations apparently seems to be in web applications to give the illusion of a more stateful webapplication. However, some argue that continuations in web applications are an 'unsuitable abstraction' with a lot of side-effects/issues which may not be directly apparent to some.

But my goal was (and still is) to implement a feature-complete, semantically correct Ruby language for the CLR. As a result, I've spent some time today to prototype continuations in IronRuby. See for yourself what I've come up with so far. Over the next few weeks I'll probably continue working on this implementation and test it against more realistic applications of continuations. Feel free to post tests that I can use as an input to test the implementation.

Your RSS feed doesn't contain a description

<description><div></div></description>

Unless you expect me to visit your site every time you update your blog... which I won't :-)
Fixed.
I believe there's a paper floating around on how to implement continuations using the CLR's exception implementation - see this: http://www.ccs.neu.edu/scheme/pubs/stackhack4.html

http://plas.fit.qut.edu.au/Ruby.NET/
Ahh continuations. All the language mavens love them and nobody seems to have a "killer app" for them. What to do?

We've struggled with the continuation question on the JRuby project as well. JRuby was ported directly from the C code, which means that it's 90%+ compatible. Recently, we've made great strides in getting major Ruby apps to work like RubyGems, Rails, and Rake. However the current design doesn't support continuations in any way.

My original plan, a little over a year ago, was that we would move to an m:n threading model where all Ruby threads were lightweight and backed by one or more native threads, floating or locked. This would then necessarily allow for continuations, since thread state could then easily be frozen and restored.

However we've managed to do some amazing things without either green threading or continuations. Most of the major apps (I might dare say all of the major apps) do not use continuations, and many don't even use threading. Add to this the fact that Matz has declared green threads and continuations will not be in Ruby 2.0 and the motivation for implementing them is very limited. At the moment, we have no plans to do either, focusing primarily on making compatibility better and refactoring the older bits of JRuby to faster, more Java and JVM-friendly versions. Continuations have fallen almost completely off the list.
Your message will be encoded/formatted when it is displayed. If you want to post code, please put the code inside [code=X][/code] tags, where X is the language of your code (C#, ASPX, SQL, etc).
Name:
Email:
(will be encoded using JavaScript to keep it functional and prevent it from being picked up by spammers)
Url:
 
Message:
3 + 3 =