[plt-scheme] SXML for R6RS [was: R6RS Interoperability]

From: Derick Eddington (derick.eddington at gmail.com)
Date: Thu Jul 10 03:36:32 EDT 2008

On Wed, 2008-07-09 at 07:18 -0600, Matthew Flatt wrote:
> Suppose that you actually want ports to be closed when control escapes
> (for any reason), so you write
>  (define (call-with-input-file* file proc)
>    (let ([p #f])
>      (dynamic-wind
>        (lambda () (set! p (open-input-file file)))
>        (lambda () (proc p))
>        (lambda () (close-input-port p) (set! p #f)))))
> and use that, instead. Then, doesn't my objection about `ssax:warn' and
> `guard' hold?

Using dynamic-wind like that would have the same issue with any possible
exception re-raised by a guard, and if there were multiple guards which
re-raise, it would exit and re-enter for each guard.  Or what if
somewhere down in proc's dynamic extent it uses a procedure which
escapes to some continuation and then re-enters back?  Assuming the
dynamic extent will only be entered and exited once just seems like a
bad idea unless you can be certain of that.  If you want the port to be
closed when control escapes, a possible guard is one of the ways control
could escape.  I don't see how making ssax:warn raise an exception
singles it out when there are other ways control could escape and
re-enter.  Am I missing something?

: Derick

Posted on the users mailing list.