[plt-scheme] why no send/suspend in tutorial? (was: Re: web-server question)

From: John Clements (clements at brinckerhoff.org)
Date: Mon Dec 8 23:32:27 EST 2008

On Dec 8, 2008, at 7:43 PM, Jay McCarthy wrote:

> I think you are looking for send/suspend/dispatch:
> (send/suspend/dispatch
>  (lambda (embed/url)
>   (let ([p ....])
>    `(a ([href ,(embed/url (lambda (req) (remove-post!  
> p) ....))]) ....)))
> http://docs.plt-scheme.org/web-server/web_ss.html#(def._((lib._web- 
> server/servlet/web..ss)._send/suspend/dispatch))

I've been thinking about this for a few weeks now, but this prompts  
me (er, so to speak) to write:

Send/suspend/dispatch seems like a sometimes-useful function, but  
that exclusive use of send/suspend/dispatch (as the new tutorial  
exemplifies) makes impossible the "nice" thing that continuations  
enable.  In particular, I'm thinking of code like this, from my  
solution to one of Shriram's assignments:

(let loop ()
   (let ([new-post (get-post)])
     (when (confirm-post? new-post)
         (add-post! new-post))

The idea is that get-post and confirm-post? both use send/suspend.   
However, if you try to rewrite these to use send/suspend/dispatch,  
then you lose the ability to write the program this way without using  
hidden fields, which is really the raison d'etre of the PLT web  
server, IIUC.

John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20081208/fdd075fc/attachment.p7s>

Posted on the users mailing list.