[plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS]
At Thu, 10 Jul 2008 07:23:09 -0700, Derick Eddington wrote:
> On Thu, 2008-07-10 at 06:02 -0600, Matthew Flatt wrote:
> > Turning the above around, if a library captures and restores
> > continuations, then it's placing an extra burden on users of the
> > library to accommodate continuation jumps. That sounds like a big price
> > to pay to get warnings from SSAX --- but perhaps I'm not enough of an
> > SSAX user to say. If SSAX users understand that functions capture and
> > restore continuations anytime that they might report a warning, and if
> > they're happy with that API, then it's all fine.
>
> I agree that would be a big price, too big and too unexpected of a
> price. Now I think I realize there's another issue you are considering
> that I was not: in PLT at the moment, `raise-continuable' is capturing
> its continuation which gets restored if the handler returns, and this is
> why my `ssax:warn' would be capturing and restoring continuations.
No. Even in the PLT implementation, the problems start when someone
uses `guard' or `with-handlers' to catch exceptions.
> (unless `guard' handlers which re-raise are involved, but
> that's an argument against using `guard' I think, not against using
> continuable exceptions).
I agree that the problem is with the combination of continuable
exceptions, `guard' or `with-handlers', and `dynamic-wind'. Maybe the
question amounts to deciding whether continuable exceptions or
`guard'/`with-handlers' is the right model for exceptions.
As you may have detected, I'm skeptical of continuable exceptions ---
or at least with merging into the system for non-continuable
exceptions.
> (raise obj) procedure [...]
> (raise-continuable obj) procedure [....]
>
> Maybe I'm reading into this too much thinking it means the dynamic
> extent will not be exited and re-entered.
That's my reading, too, and the PLT implementation is consistent with
that.
The PLT implementation of `guard' is really the part that fails to
conform with R6RS, and it's all tied up with the need sometimes to tame
continuations.
Matthew