Started: 3 December 2004, 13:58 UTC
Finished: 4 February 2006, 7:56 UTC

Serializable Continuations for Web Programming

When programming for the web, it's annoying that there is no persistence. Yet, because users can use the Back button, open links in new windows, make bookmarks and generally move all over the place, ordinary persistence is a bit of a mess.

The word of the OSDC 2004 conference was continuation; here's a quick explanation of continuations.

Now, it seems to me that the model of the web corresponds pretty well to continuations. The program runs up to the point where interaction with the user is required. At that point, it encodes the continuation into the links given to the user, and quits.

When the user clicks one of those links, the URL contains a continuation and whatever response the user gave. Decode the continuation, resume it, and voila! - it all works.

Done properly, it'd be mostly invisible to the programmer. Just call a function to display the web page, and get back an answer. No sessions or any of that stuff.

The user can use the back button, have several windows open, bookmark a page and come back to it weeks later - everything works.

Security considerations

Obviously, running continuations that come in from the net can be hazardous. Two options:

Another concern is updates. If one of your libraries has a security update, then - depending on how the continuations are made - you might have to invalidate the lot of them.


Idea: article ratings for a blog-reader