<div dir="ltr">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!<div><br>

</div><div><font face="courier new, monospace"><br style="font-size:13px"></font><div><font face="courier new, monospace"> (with-exception-handler</font></div><div><font face="courier new, monospace">  (lambda (e)</font></div>

<div><font face="courier new, monospace">    (print "Outer.\n")</font></div><div><font face="courier new, monospace">    'outer-handler-result)</font></div><div><font face="courier new, monospace">  (lambda ()</font></div>

<div><font face="courier new, monospace">    (continuation-capture</font></div><div><font face="courier new, monospace">     (lambda (cont)</font></div><div><font face="courier new, monospace">       (with-exception-handler</font></div>

<div><font face="courier new, monospace">        (lambda (e)</font></div><div><font face="courier new, monospace">          (print "Inner.\n")</font></div><div><font face="courier new, monospace">          (let ((r (continuation-graft cont (lambda () (raise e)))))</font></div>

<div><font face="courier new, monospace">            (print "Passing on " r ".\n")</font></div><div><font face="courier new, monospace">            r))</font></div><div><font face="courier new, monospace">        (lambda () (list 'raise-returned: (raise 'err))))))))</font></div>

<div><font face="courier new, monospace"> </font></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/1 Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 2013-03-31, at 3:02 PM, Mikael <<a href="mailto:mikael.rcv@gmail.com">mikael.rcv@gmail.com</a>> wrote:<br>
<br>
> Dear Marc,<br>
><br>
> (with-exception-handler<br>
>  (lambda (e)<br>
>    (print "Outer.\n")<br>
>    'outer-handler-result)<br>
>  (lambda ()<br>
>    (with-exception-handler<br>
>     (lambda (e)<br>
>       (print "Inner.\n")<br>
>       (let ((r (raise e)))<br>
>         (print "Passing on " r ".\n")<br>
>         r))<br>
>     (lambda () (list 'raise-returned: (raise 'err))))))<br>
><br>
> prints out "Inner.\n" in an infinite loop currently. Is it not supposed to output<br>
><br>
> Inner.<br>
> Outer.<br>
> Passing on outer-handled-result.<br>
><br>
> and then return '(raise-returned: outer-handler-result) ?<br>
<br>
</div>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).<br>


<span class="HOEnZb"><font color="#888888"><br>
Marc<br>
<br>
</font></span></blockquote></div><br></div>