[R6RS] syntax-case

Marc Feeley feeley
Thu Oct 14 20:49:46 EDT 2004


> The intent is to include pretty much what's in the note I sent on the
> 15th of September, but we might also include a more general version of
> identifier-syntax, which is currently limited to patterns and templates
> in the sense of syntax-rules.

Frankly I don't see why there needs to be a separate form for identifiers.
Couldn't this be folded into syntax-case?  For example:

(define-syntax foo
  (lambda (x)
    (syntax-case x ()
      (_
       (syntax bar))
      ((set! _ y)
       (syntax (set! bar y))))))

I.e. syntax-case would behave specially when the first clause's pattern
is an identifier.  In that case the next pattern would be checked for
a "set!" pattern.

I would prefer this so that it would be possible to write:

(define-syntax foo
  (lambda (x)
    (syntax-case x (:=)
      (_
       (syntax bar))
      ((set! _ y)
       (syntax (set! bar y)))
      ((_ := y) ; ugly syntax just for sake of example
       (syntax (set! bar y))))))

That is, match more than just a reference and assignment pattern.

Marc


More information about the R6RS mailing list