Delimited continuations look interesting. I'd be curious if you could implement something like SJS's ALT operator ('@') with them:
A@B follows both branches A and B simultaneously and, as soon as either one of them returns, it cancels the other one. Cancellation means that the 'losing' branch gets a chance at cleaning up after itself (close sockets, remove ui, etc) and then gets abandoned.
(Disclaimer: I work on SJS)
It transforms this:
Into this: Basically, it uses code transformation to transform "synchronous" code into "asynchronous", callback-based code. The previous example isn't too bad, but if one starts adding many more callbacks, code can quickly become much more unreasonable. Worse still, it gets painful to refactor synchronous code into asynchronous code and back. Stratified JavaScript attempts to handle this slow, largely mechanical work for you.It's not actually this simple, though--the javascript is actually compiled down to a representation that is executed by the Oni (http://www.croczilla.com/oni) runtime.
It also appears to allow one to "suspend" code at the callback breaks, passing it around as a continuation and resuming when required.
I would say this effort is broadly similar to the delimited continuations support in Scala 2.8. See http://www.scala-lang.org/node/2096.