[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Y Store /Closures



Daniel Weinreb wrote:

>
> Now, here's what I want to know. Suppose you want to write a web
> app that maintains state between clicks in the fashion I've been 
> describing,
> but you don't want all that state to be lost in case there is a reboot or
> power failure or crash. In the event-driven style, the state can be 
> stored
> persistently, in a file or database system, so that when the next HTTP
> request comes along, you can pick up where you left off, but in a 
> conventional
> language-with-continuations scenario, the continuation state is all in 
> virtual
> memory and lost when there's a crash.  What can anyone recommend?

In the project I mentioned in my previous post we had to use Java, so we 
didn't have continuations in the language. Since we wrote the code in 
CPS, there was no control stack to maintain. The data, however, had to 
be maintained between requests. We took advantage of the scoping rules 
for inner classes to "close" the lexical context into an instance of an 
inner class. Then we serialized that instance, and put it in the servlet 
session context. We could have also store it persistently at that point 
(we didn't at the time, they may do that today.)

This didn't directly answer your question, however. The author of the 
articles I mentioned before (Christian Quinnec) also wrote an 
implementation where he used Scheme runnning on the server, and made use 
of true continuations. I seem to remember he mentioned that "saving the 
world" in that context was expensive, though.

--Florin