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

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Dec 9 09:47:40 EST 2008

The documentation [1] says this:

Calls make-response with a function that, when called with a procedure
from request? to any/c will generate a URL, that when invoked will
call the function with the request? object and [HERE]return the result
to the caller of send/suspend/dispatch.[/HERE]

The section marked "[HERE]" says that s/s/d returns the result to its caller.

The only example that is given uses this feature:

 (define (count-dot-com i)
    (count-dot-com
     (send/suspend/dispatch
      (lambda (embed/url)
        `(html
          (head (title "Count!"))
          (body
           (h2 (a ([href
                    ,(embed/url
                      (lambda (req)
                        (sub1 i)))])
                  "-"))
           (h1 ,(number->string i))
           (h2 (a ([href
                    ,(embed/url
                      (lambda (req)
                        (add1 i)))])
                  "+"))))))))

I'm not sure what else you think I should do. Do you mean mention that
(embed/url identity) recreates s/s?

Jay


1. http://docs.plt-scheme.org/web-server/web_ss.html#(def._((lib._web-server/servlet/web..ss)._send/suspend/dispatch))

On Mon, Dec 8, 2008 at 11:02 PM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
> I agree.  This is worth describing more explicitly in documentation
> with actual examples, because John's assumption is absolutely the
> natural one to make.
>
> On Tue, Dec 9, 2008 at 12:52 AM, John Clements
> <clements at brinckerhoff.org> wrote:
>>
>> On Dec 8, 2008, at 8:54 PM, Jay McCarthy wrote:
>>
>>> Everything you can do with s/s you can do with s/s/d (and vice versa),
>>> because send/suspend/dispatch returns the result of the request
>>> handler to its continuation.
>>
>> Ah, I see. The idiomatic use is so close to the CPSed style required by most
>> web apps that I assumed that it didn't return to the existing continuation.
>> Thanks!
>>
>> John
>>
>>
>>
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>>
>



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

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


Posted on the users mailing list.