[racket] Server side continuations

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Jun 13 17:37:20 EDT 2011

On Friday, Shriram Krishnamurthi wrote:
> I wonder if he's read the structure of JavaScript programs, which --
> because of the cooperative multi-tasking structure of JavaScript --
> have to return control to the event loop (ie, "terminate") whenever
> they make an Ajax request, leaving *another procedure* to pick up
> the response if and when it arrives.  What a nifty pattern -- I
> really wish it had a name!  Oh wait, I guess these days it's called
> "Ajax" -- which makes it all good.

But of course ajax is too vague an low level -- so it's wrapped in
things like node.js.  I've recently looked at it (node.js) in an
attempt to figure out what's all the noise about, and it's surprising
how little you get from it.  Practically any text on it explains the
IO problem and then goes on with examples like

    foo(1, 2, function(x,y) {
      bar(x+y, function(z) {

But nobody minds the extra work -- and that seems to be achieved
through some very specific vocabulary, words like "hotness" and "add
some awesome" tends to get a certain kind of people all excited (eg,
"nodejitsu").  Not to mention the many places that refer to it as
"non-blocking evend-driven", and conclude (with a straight face) that
it's a real-time high performance system.

On the plus side, people are very aware of first class functions.  I
can imagine the kind of responses such code would get 10 years ago,
but now it's cool.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.