[plt-scheme] Re: Writing stateless servlets: what is an "unsafe context"?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Jan 21 12:56:13 EST 2010

An unsafe context is a context that includes un-transformed code. Here
is an example from the docs:

(build-list
   3
   (lambda (i)
     (call-with-serializable-current-continuation
      (lambda (k) (serialize k)))))

'build-list' isn't transformed.

On Thu, Jan 21, 2010 at 10:34 AM, John Clements
<clements at brinckerhoff.org> wrote:
> I feel like I ought to be able to figure this out, but I'm getting an error message from serve/servlet that says:
>
> ../../../../../svn/clements/research/tdd-grant/first-applet/first-applet.ss:79:7: Servlet (@ /servlets/standalone.ss) exception:
> Attempt to capture a continuation from within an unsafe context: (#((#t send/suspend) #f) #((#t (lambda (x2122))) #f) #((#f stx) #f) #((#t start) #f))
>
> From the standpoint of the stateless compiler, what is an "unsafe context"? I searched the stateless server page for the phrase "unsafe context" without success.
>
>
> Would it be bad if I did something like this, in order to capture the URL associated with the continuation?
>
> (let ([url-cell (box #f)])
>  (send/suspend (lambda (url) (set-box! url-cell url) (render-the-page url)))
>  ...)

I don't think it would be terrible.

>
>
> BTW, deploying servlets with the new language set is *very* smooth; no more taking ten minutes to set up a nice directory structure for the server to run in. Thanks!
>
> John
>
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.