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

Re: [Scheme-reports] 6.1 Exceptions needs examples



Helmut Eller scripsit:

> guard could avoid full continuations in (at least) two ways:
> 
> 1. When no cond-clause matches, guard re-raises the condition in the
>    dynamic context of the guard form.  This is similar to Java's
>    try-catch (+ the implicit re-throw).
> 
> 2. Evaluate the cond-tests in the dynamic environment of the original
>    raise.  The advantage of this strategy is that it preserves the
>    context of the error; which is useful for debugging.  This is similar
>    to Common Lisp's HANDLER-CASE.

#2 is trivially simulated by using `with-exception-handler` and putting
the cond inside the handler.  The point of `guard` is that it packages
up the necessary escape operation.

If I had to choose, I'd prefer #1.  Note that if there is no else clause,
the behavior is effectively #1.  A compiler or smart macro-expander
could notice this and take advantage of it.

-- 
A poetical purist named Cowan           [that's me: cowan@x]
Once put the rest of us dowan.          [on xml-dev]
    "Your verse would be sweeter        http://www.ccil.org/~cowan
    If it only had metre
And rhymes that didn't force me to frowan."     [overpacked line!] --Michael Kay

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