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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Jan 20 12:51:19 EST 2012

Jay, I agree. This would be a good starting point, so others can find it too. 


On Jan 19, 2012, at 2:02 PM, John Clements wrote:

> 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
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



Posted on the users mailing list.