[r6rs-discuss] Restriction on srpattern should be dropped

From: David Van Horn <dvanhorn>
Date: Fri, 13 Jul 2007 20:47:04 -0400

The description of macro transformers in section 11.19 states:

   Each <syntax rule> must have the following form:

   (<srpattern> <template>)

   An <srpattern> is a restricted form of <pattern>,
   namely, a nonempty <pattern> in one of four
   parenthesized forms below whose first subform
   is an identifier or an underscore _.

The restriction is sensible for a language such as R5RS in which
transformers can be applied only to syntax representing a macro
instance (a non-empty parenthesized form, whose first subform is a
syntactic keyword). This is no longer true in the current draft of
R6RS since one can write:

   (import (rnrs))
   ((syntax-rules ---) ---)

Restricting the domain of procedures created with syntax-rules is
artificial and needless. The restriction should be dropped and
<srpattern> should be replaced simply with <pattern>. It's a trivial
simplification to the syntax-case definition of syntax-rules given in
12.8 (libraries). Dropping the restriction allows the following
examples to work as expected:

   (import (rnrs))
   (syntax-rules () (x x)) ;; identity function on syntax.
   ((syntax-rules ()
      (#t 'true)
      (#f 'false))
    (syntax #t)) ;; => 'true

David
Received on Fri Jul 13 2007 - 20:47:04 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC