[gambit-list] with-exception-handler supports recursion?

Marc Feeley feeley at iro.umontreal.ca
Sun Mar 31 19:42:31 EDT 2013


On 2013-03-31, at 3:02 PM, Mikael <mikael.rcv at gmail.com> wrote:

> 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) ?

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




More information about the Gambit-list mailing list