[plt-scheme] 369.3
> One minor change is that a low-level exception handler, as installed
> with `call-with-exception-handler', can chain to the "previous" handler
> by simply returning a value:
I'm a little confused. It seems very difficult to *prevent* chaining
when you don't want it, e.g. to implement `with-handlers'-like behavior
(where an inner exception handler whose predicate succeeds overrides any
outer exception handlers). I tried capturing a continuation:
...
(let/cc k
(call-with-exception-handler
(lambda (x) (k x))
(lambda () (raise 10))))
but that's illegal because it's performing a jump across a continuation
barrier. (Is this the continuation barrier placed around the handler
when it's invoked in the continuation of the `raise' expression?)
If I understand what I was doing, I think managed it with a prompt and
abort:
...
(call-with-continuation-prompt
(lambda ()
(call-with-exception-handler
(lambda (x) (abort-current-continuation tag x))
(lambda () (raise 10))))
tag
(lambda (x) x)))
AFAICT from macro-stepping, I think that's how `with-handlers' is
implemented: install a prompt, invoke the handler, and abort to the
prompt if the handler succeeds.
Is that right? Why is it that it's legal to abort across the
continuation barrier but not to jump across it?
Dave