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

Re: Variable transformers and transformer forms

This page is part of the web mail archives of SRFI 93 from before July 7th, 2015. The new archives for SRFI 93 contain all messages, not just those from before July 7th, 2015.



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/