[racket-dev] Web continuations interaction with BSL

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Sat Sep 4 23:06:23 EDT 2010

OK, next puzzle:
Here's a simple web servlet that displays two linked pages:

;; serveit.rkt
#lang racket
(require web-server/servlet
         web-server/servlet-env)
; serve-it : string string -> void
(define (serve-it text1 text2)
  (serve/servlet
   (λ(req)
     (send/suspend/dispatch
      (λ(make-url)
        (letrec ([page1 (λ(req) `(html (p ,text1)
                                       (p (a ([href ,(make-url
page2)]) "Page2"))))]
                 [page2 (λ(req) `(html (p ,text2)
                                       (p (a ([href ,(make-url
page1)]) "Page1"))))])
          (page1 req)))))))
(provide serve-it)


This runs fine on its own.

Now, trying to use this from a BSL program,
   (require "serveit.rkt")
   (serve-it "This is the first page" "This is the second page")

will render the first page fine, but the link doesn't work. It seems
like the continuations are being generated, but are then not
accessible somehow?


Posted on the dev mailing list.