Re: [Scheme-reports] 6.1 Exceptions needs examples Helmut Eller (21 Mar 2012 06:51 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Aaron W. Hsu (21 Mar 2012 19:46 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples John Cowan (21 Mar 2012 20:12 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Helmut Eller (22 Mar 2012 08:27 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Andy Wingo (22 Mar 2012 13:28 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples John Cowan (22 Mar 2012 14:17 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Helmut Eller (22 Mar 2012 16:36 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Aaron W. Hsu (22 Mar 2012 17:10 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Helmut Eller (22 Mar 2012 18:09 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Andy Wingo (22 Mar 2012 18:22 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples John Cowan (22 Mar 2012 23:30 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Helmut Eller (23 Mar 2012 06:11 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples John Cowan (23 Mar 2012 06:22 UTC)
Re: [Scheme-reports] 6.1 Exceptions needs examples Helmut Eller (21 Mar 2012 22:40 UTC)

Re: [Scheme-reports] 6.1 Exceptions needs examples John Cowan 22 Mar 2012 23:30 UTC

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@ccil.org]
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@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports