[r6rs-discuss] [Formal] The implicit cond in guard expressions is not a good idea
On Mon, 30 Oct 2006, Trent Buck wrote:
> AFAICT it's only real purpose is to allow users to omit a couple of
> LAMBDAs, i.e.
>
> (guard X Y Z ...)
> ---> (with-exception-handler (lambda (X) Y) (lambda () Z ...))
Not quite, since it automatically reraises the exception if no clause is
satisfied. I don't know the motivation of the editors, but if I had to
guess, this automatic reraising may be the main reason for having "guard".
See, e.g., Java "catch".
I agree with Aziz that the syntax is strange (at the very least, the bracketing
looks wrong to me). However, Aziz's counterproposal does not address the
automatic reraising.
> R5.91RS doesn't specify thin syntactic wrappers for CALL/CC,
> DYNAMIC-WIND, WITH-INPUT-FROM-FILE or WITH-OUTPUT-TO-FILE. Why does
> WITH-EXCEPTION-HANDLER warrant one?
+1 (although call-with-values already breaks the mold here). I think there are
also other very good reasons for leaving "guard" out of r6rs.
- Specific shops may have different exception requirements and conventions.
in each case, the appropriate "guard" macro would look different
and do different things.
- Some may require automatic logging before handling the exception.
- Some may have a convention for which an implicit CASE (not COND)
would be more concise and more appropriate.
- Some may require automatic reraising of only some types of exception.
- Some may wish to handle specific exceptions implicitly by default,
without the user having to include them in a guard clause.
etc. In other words, the design space is too large, and most shops require at
least one of the above, so they would not be using the r6rs "guard" anyway.
Andre
Received on Mon Oct 30 2006 - 05:07:13 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC