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

Re: Y Store /Closures

[My apologies for multiple copies, but I accidentally posted from my 
wife's account, and I'm not sure the message made it to the list.

On Fri, 28 Feb 2003, Sundar Narasimhan wrote:

>Ok. What is the framework that Avi is talking about / where can one
>get such hands-on experience? Don't get me wrong -- I perfectly
>understand the benefits of what certain languages can provide in the
>back-end. It's just that I don't think some of the ones that people
>have mentioned are indispensable (yet), mainly because I've been
>benchmarking our performance wrt. some of these, and back-end server
>programming seems to go pretty quickly with the tools that are out
>there now.. perhaps I'm missing something.

I haven't so far participated in this discussion (or any other on this 
list), but I thought I'd briefly come out of lurk-mode for this subject.

I am an "industry" guy, and I am surely in Avi's camp: the first time I 
looked at Web flow in terms of continuations I had such an "Aha!", that 
afterwards I could never look at the problem in any other terms; it just 
didn't feel natural. Other forms of encoding "page" flow (it's easy to 
forget it's actually *program* flow), looked to me as contrived ways of 
capturing (only partially) what in fact is expressed directly by the 
concept of continuation.

The problem my company had at the time was to be able to implement a 
very large number of custom check-out scenarios in very short 
timeframes, together with a large projected number of back-office 
workflows that had to be accessed from the browser. We didn't even know 
how those scenarios would actually look like, we just had a general 
idea. We also had to prototype some pretty complex scenarios in almost 
no time, and make sure that whatever we used fit well within the 
existing architecture.

Fortunately, I happened to read a remark made by Matthias Felleisen on 
another list, along the lines that "doing cgi programming involves CPS 
conversion", and then it dawned on me: we could design all our flows in 
Java, in direct style, and then apply CPS conversion manually, to make 
up for the fact that Java doesn't have first class continuations. We 
decided it was worth the pain, because it was so much easier to design 
that way. We ended up implementing a scheme of encoding continuation 
id's in URL's, and using inner classes to simulate closures. Although 
most of my colleagues hadn't done CPS conversion before, and indeed 
weren't familiar with continuations, they learned pretty quickly, and 
soon became proficient in designing new flows. The system works the same 
way today (I left the company a year ago.)

Here are two papers of Christian Quinnec's that attempt to motivate the 
closure/continuation approach (Paul Graham made much of same points very 
briefly in one of his articles which I cannot locate at the moment):