[racket] design and use of continuation barriers

From: Taylor R Campbell (campbell+racket at mumble.net)
Date: Sat Jul 10 16:53:10 EDT 2010

   Date: Sat, 10 Jul 2010 20:45:29 +0000
   From: Taylor R Campbell <campbell+racket at mumble.net>

   What should I do if I want to preclude only multiple uses of the
   continuation, but still allow single uses even if they are non-local?

Sorry, should've spent half a minute thinking about that before making
my message even longer by asking it.

(define (guarantee-single-return procedure)
  (let ((returned? #f))
    (begin0 (procedure)
      (if returned? (error "Multiple return prohibited."))
      (set! returned? #t))))


Posted on the users mailing list.