[plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS]
On Thu, 2008-07-10 at 08:56 -0600, Matthew Flatt wrote:
> 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.
>
> > (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.
Thanks for clearing that up.
> > (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.
This is the first time I've used continuable exceptions. It seems like
a pretty cool thing to be able to use the exception system to signal a
warning (an exceptional situation) and let interested users install a
handler so they can interpret the warning and decide if they want to
allow the program to continue, or by default it will continue because
it's non-&serious. Otherwise it seems you've got to invent some other
separate warning/non-serious signaling system. And similarly, you can
use continuable exceptions for &serious conditions, and if they're not
handled by a user-installed handler which returns, the program will be
stopped by default. But combining with `guard' re-raising does look
incompatible.
--
: Derick
----------------------------------------------------------------