mit-scheme-devel
[Top][All Lists]
Advanced

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

[MIT-Scheme-devel] ellipsis depth checking in SYNTAX-RULES


From: Taylor Campbell
Subject: [MIT-Scheme-devel] ellipsis depth checking in SYNTAX-RULES
Date: Wed, 4 Jan 2006 05:29:58 +0000
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/7.7.90.+

MIT Scheme's SYNTAX-RULES implementation currently requires (& checks)
that ellipsis depth be matched by all pattern variables in any
template using them.  For example, this macro fails:

  (define-syntax foo
    (syntax-rules ()
      ((FOO x y ...)
       '((x y) ...))))

because x & y have different ellipsis depth from the pattern: x is not
repeated, while y is repeated.  The output of this macro, though, is
unambiguous: (FOO 5 3 1) would expand to ((5 3) (5 1)) if SYNTAX-RULES
did not check this.  In fact, its current implementation goes out of
its way to check that the depth matches: ADD-CONTROL! goes out of its
way, in lines 227 & 228 of syntax-rules.scm, to verify that that depth
matches; the above FOO macro works if those two lines are removed.  Is
there a reason for this check?  It makes some macros very hard to
write, because one must resort to lower-level macros to generate that
kind of repetition.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]