[plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS]

From: Felix Klock's PLT scheme proxy (pltscheme at pnkfx.org)
Date: Fri Jul 11 10:59:40 EDT 2008

Robby (cc'ing plt-scheme and the rest of the people involved in the  

On Jul 11, 2008, at 10:49 AM, Robby Findler wrote:

> On Fri, Jul 11, 2008 at 9:42 AM, Derick Eddington
> <derick.eddington at gmail.com> wrote:
>>>> Would it be possible to have guard just not jump out,
>>> It should jump out for the same reasons as `with-handlers', right?
>> What are those reasons?  I've never known.
> One reason is that loops that involve a with-handlers won't be
> tail-recursive (unless you jump out yourself in the handler of
> course).
> Something like this:
> (define (keep-trying)
>  (with-handlers ([whatever? (lambda () ... (keep-trying))])
>    ...))

That example seems like it justifies jumping out before the evaluation  
of the <expression> ... of each <cond clause> of the guard

But does it justify such jumping before the evaluation of the <test>  
of each <cond clause> of the guard?

I would think the <test> expression would be the point of interest  
when it comes to continuable exceptions...

(The only justification I have been able to come up for jumping out  
before each <test> with is that if there are side-effects to things  
like (current-output-port) in the <test>, it is easier to reason about  
them if they are set according to the dynamic environment of the whole  
guard expression.  But I am not yet convinced that this benefit is  
worth the paying the cost of the jump...)


Posted on the users mailing list.