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

From: Galler (lzgaller at optonline.net)
Date: Wed Jan 4 01:33:06 EST 2012

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 

(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 

Anedcotally, application speed seems at or better than the stateful 


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120104/a13b7e6d/attachment.html>

Posted on the users mailing list.