Dear Marc,
(with-exception-handler (lambda (e) (print "Outer.\n") 'outer-handler-result) (lambda () (with-exception-handler (lambda (e) (print "Inner.\n") (let ((r (raise e))) (print "Passing on " r ".\n") r)) (lambda () (list 'raise-returned: (raise 'err))))))
prints out "Inner.\n" in an infinite loop currently. Is it not supposed to output
Inner. Outer. Passing on outer-handled-result.
and then return '(raise-returned: outer-handler-result) ?
(Found something that may be very related and filed it as https://www.iro.umontreal.ca/~gambit/bugzilla/show_bug.cgi?id=175 .)
Thanks and best regards, Mikael
Afficher les réponses par date
On 2013-03-31, at 3:02 PM, Mikael mikael.rcv@gmail.com wrote:
That's the correct behavior. Don't confuse with-exception-catcher (which corresponds to try/catch in other programming languages) and with-exception-handler (which installs an exception handler which will be active when the exception handler is called).
Marc
Aaha, noted. So the way to stack exception handlers atop of each others are by continuation-capture as you gave an example of in the previous email, here applied to this usecase. Thanks for clarifying!
(with-exception-handler (lambda (e) (print "Outer.\n") 'outer-handler-result) (lambda () (continuation-capture (lambda (cont) (with-exception-handler (lambda (e) (print "Inner.\n") (let ((r (continuation-graft cont (lambda () (raise e))))) (print "Passing on " r ".\n") r)) (lambda () (list 'raise-returned: (raise 'err))))))))
2013/4/1 Marc Feeley feeley@iro.umontreal.ca