[racket] continuation barrier in raise

From: Casey Klein (clklein at eecs.northwestern.edu)
Date: Wed Jan 5 07:56:05 EST 2011

On Wed, Jan 5, 2011 at 6:32 AM, Keiko Nakata <keiko at kurims.kyoto-u.ac.jp> wrote:
> Hello,
>
> Will someone give me an example which shows the continuation barrier
> introduced by 'raise'?  I.e., I want an program which raises an exception
> because of the barrier.
>
> I think I do not understand the documentation properly,
> so have been failing  to produce such an example myself...
>

How about this one?

(define t (make-continuation-prompt-tag))

(call-with-continuation-prompt
 (λ ()
   (call-with-exception-handler
    (λ (_)
      (call-with-current-continuation
       (λ (k) (abort-current-continuation t k))
       t))
    (λ () (raise 3))))
 t
 (λ (k)
   (call-with-continuation-prompt
    (λ () (k 4))
    t)))


Posted on the users mailing list.