[R6RS] syntax-case

R. Kent Dybvig dyb
Fri Oct 15 00:17:50 EDT 2004


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

Generalized identifier macros can be written using syntax-case in both
Chez Scheme and DrScheme, only (set! keyword expr) is a syntax error
unless the transformer associated with keyword is marked somehow as
willing to accept set! forms, e.g., something like:

  (define-syntax foo
    (set!-aware-transformer
      (lambda (x)
        (syntax-case x (set! :=)
          [id (identifier? #'id) #'bar]
          [(set! _ y) #'(set! bar y)]
          [(_ := y) #'(set! bar y)]))))

This frees the more common macros that don't need to handle set!
expressions from having to deal with the possibility of being handed one.

Kent


More information about the R6RS mailing list