<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">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.<div><br></div><div>John</div><div><br></div><div><br><div><div>On Jan 3, 2012, at 10:33 PM, Galler wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">On the subject of porting #lang racket to #lang web-server code </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">I provide a few lessons learned for the archives for the next person to attempt this. </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>1) Bindings, Serializability </b>, <b>and anonymous functions </b></font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>1A) the predicate serializable? from racket/serializable is invaluable </b></font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">#lang web-server code will not transform if there are non-serializable constructs in the dynamic extent of the invocation of send/suspend </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">some minor surprises/lessons learned: </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>1B) anonymous functions are not serializable </b></font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">(serializable? (λ (x) x)) ;->#f </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>1C) anonymous functions in a list are not serializable </b></font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"> (serializable? (car (list (λ (x) x) (λ (x) x)))) ;->#f </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>1D) once given a module-level binding, anonymous functions become serializable </b></font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">(define foo (list (λ (x) x) (λ (x) x))) </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">(serializable? (car foo)) ;->#t </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>1E) void is not serializable </b></font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">(serializable? void) ;->#f </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>1F) anonymous functions bound within a letrec form are serializable </b></font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"> </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>2) 'attempt to cross a continuation barrier' exceptions </b></font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">invocations of native continuations reified with call/cc seemed to frequently throw this error </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">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. </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"> (call-with-continuation-prompt k (default-continuation-prompt-tag) </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><b>3) with-continuation-marks, continuation-marks, and current-continuation-marks can be used to replace dynamic-wind </b></font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">Again, thank you. I think the stateless web-language is important technology and must have required an enormous amount of work to implement. </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">Anedcotally, application speed seems at or better than the stateful code. </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">R./ </font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">Zack </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">On Sun, Jan 1, 2012 at 4:36 PM, Jay McCarthy wrote: </font></div><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0"><br></font><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">> On Sat, 31 Dec 2011 20:03:02 -0600,Robby Findler <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>> mumbled: </font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">> > I'm not sure if the web-server supports continuation marks or not </font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">> </font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">> The stateless transformation does support continuation marks, provided </font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">> the keys and values are serializable. (Parameters/exception handlers are not </font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">> supported because the key is not serializable.) </font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">> </font></div><div align="LEFT"><font face="Verdana" size="2" color="#000000" letterspacing="0" kerning="0">> Jay </font></div>____________________<br> Racket Users list:<br> <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br></blockquote></div><br></div></body></html>