[R6RS] Semantics of `raise'

William D Clinger will at ccs.neu.edu
Mon Mar 13 11:42:02 EST 2006


>From our previous discussion, I think the intended semantics of
raise-continuable is:

(raise-continuable obj)
   Raises a continuable exception by invoking the current exception
   handler on obj. The handler is called with a continuation that is
   equivalent to the continuation of the call to `raise-continuable'
   with these two exceptions: (1) the current exception handler is
   the one that was in place for the call to `with-exception-handler'
   that installed the handler being called, and (2) if the handler
   being called returns, then it will again become the current
   exception handler.  If the handler returns, the value(s) it
   returns become(s) the value(s) returned by the call to
   raise-continuable.

In terms of the reference implementation, I think the intended
semantics of raise-continuable could be written like this:

(define (raise-continuable obj)
  (let ((handlers *current-exception-handlers*))
    (with-exception-handlers (cdr handlers)
      (lambda ()
        (call-with-values
         (lambda () ((car handlers) obj))
         (lambda vals
           (with-exception-handlers handlers
             (lambda ()
               (apply values vals)))))))))

The code above has not been tested.

Will



More information about the R6RS mailing list