[racket] Engineering Tradeoffs of ANF transforms and the Stateless Server

From: John Clements (clements at brinckerhoff.org)
Date: Thu Jan 19 14:02:34 EST 2012

I think the below would make a good PLT blog post, perhaps with an opening paragraph about how much cheaper the stateless web-server can be.

John


On Jan 3, 2012, at 10:33 PM, Galler wrote:

> 
> 
> On the subject of porting #lang racket  to  #lang web-server code
> 
> I provide a few lessons learned for the archives for the next person to attempt this.
> 
> 
> 1) Bindings, Serializability , and anonymous functions
> 
> 1A) the predicate serializable? from racket/serializable is invaluable
> 
> #lang web-server code will not transform if there are non-serializable constructs in the dynamic extent of the invocation of send/suspend
> 
> some minor surprises/lessons learned:
> 
> 1B) anonymous functions are not serializable
> 
> (serializable? (λ (x) x))  ;->#f
> 
> 1C) anonymous functions in a list are not serializable
> 
>  (serializable? (car (list (λ (x) x) (λ (x) x)))) ;->#f
> 
> 1D) once given a module-level binding, anonymous functions become serializable
> 
> (define foo (list (λ (x) x) (λ (x) x)))
> 
> (serializable? (car foo))  ;->#t
> 
> 1E)  void is not  serializable
> 
> (serializable? void) ;->#f
> 
> 1F) anonymous functions bound within a letrec form are serializable
>  
> 
> 2) 'attempt to cross a continuation barrier' exceptions
> 
> invocations of native continuations reified with call/cc seemed to frequently throw this error
> 
> I haven't done enough analysis to understand why and under what conditions, but in all cases I was able to remediate by enclosing the invocation as follows.
> 
>  (call-with-continuation-prompt  k (default-continuation-prompt-tag)
> 
> 3) with-continuation-marks, continuation-marks, and current-continuation-marks can be used to replace dynamic-wind
> 
> 
> Again, thank you. I think the stateless web-language is important technology and must have required an enormous amount of work to implement.
> 
> Anedcotally, application speed seems at or better than the stateful code.
> 
> R./
> Zack
> 
> On Sun, Jan 1, 2012 at 4:36 PM, Jay McCarthy wrote:
> 
> > On Sat, 31 Dec 2011 20:03:02 -0600,Robby Findler <robby at eecs.northwestern.edu> mumbled:
> > > I'm not sure if the web-server supports continuation marks or not
> >
> > The stateless transformation does support continuation marks, provided
> > the keys and values are serializable. (Parameters/exception handlers are not
> > supported because the key is not serializable.)
> >
> > Jay
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120119/98e5f204/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120119/98e5f204/attachment.p7s>

Posted on the users mailing list.