[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] 6.11 Exceptions



On Sun, Jan 6, 2013 at 7:43 PM, Andy Wingo <wingo@x> wrote:
On Sun 06 Jan 2013 07:51, Alex Shinn <alexshinn@x> writes:

> On Sun, Jan 6, 2013 at 6:42 AM, Andy Wingo <wingo@x> wrote:
>
>     `raise-continuable' is poorly understood in the context of Scheme.
>      I
>     would punt it to WG2 if possible.
>
>
> Could you be more specific?  What exactly are the problems you see?

I have two problems with it.  One is that very few Schemers have used
it.  I asked on this list once who had used it, and no one replied in
the affirmative.  Therefore it is not "core" enough to go into a "small"
r7rs.

But it's the other way around - it's actually `raise' that is the innovation,
and `raise-continuable' which has always been available.  Anyone who
has ever found themselves in the debugger after an exception in
Gambit or MIT-Scheme or Larceny has used continuable exceptions.

The notion that you could signal, at the raise location, wether the
exception is continuable or not seemed initially surprising, but in
reality most of these implementations provide optimization levels where
the exception is not continuable, or not continuable at the _expression_
level (falling back e.g. to the enclosing procedure call continuation).

Thus `raise' is a new idea to make this same limitation available to
the programmer, and offer an explanation of why certain exceptions
may not always be continuable.

Secondly, its presence prohibits useful behaviors.  For example, it
would be easy to make a `call-with-port' that closes its port on
exceptional exits by installing a throw handler.  However, since throw
handlers are also used for raise-continuable, this is not possible.

Continuable and restartable exceptions have a long history in both
Scheme and Common-Lisp, and if nothing else are essential to
featureful debuggers.

Releasing resources can be done manually at the programmer
level with their own exception handlers, even wrapping common
patterns such as `call-with-port/close-on-exception'.  Guardians also
allow for easy and arbitrary finalization.  Ports in particular should
be closed automatically on GC, and out-of-file-descriptor errors
should trigger GC.

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports