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

Re: Variable transformers and transformer forms



David Feuer wrote:
As a convenience form I would suggest
(syntax-transformer (stx) body ...) => (syntax-case-transformer
(lambda (stx) body ...)).

This is still needlessly verbose.   A problem is the desire for
orthogonality, separating the binding (define/let/letrec-syntax)
from the transformer specification.  That is all very well for
"core" macro syntax, but it is overkill for what people need
99% of the time.

So let me repeat my suggestion, which no-one has commented on:

(define-syntax-case NAME ()
  ((_ PATTERN ...)
   EXPRESSION))
  ...)

The simple/common case (including syntax-rules):

(define-syntax-case NAME ()
  ((_ PVAR ...)
   #`(... PVAR ...))

Implementation:

(define-syntax define-syntax-case
   (syntax-rules ()
     ((define-syntax-case name literals . parts)
      (define-syntax name
        (lambda form
         (syntax-case form literals . parts))))))
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/