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

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.

Jorgen Schaefer (forcer) wrote
According to section 3.4, transformers are procedures which accept a
single argument. Not only is this incompatible with existing systems
(such as explicit renaming), it is also problematic for later
extension. I think it would be more useful to use a new form here,

I wholeheartedly agree that a new form is necessary.  In keeping with
the precedent set by R5RS, as well as the syntactic closure system of
MIT Scheme, I would propose
(define-syntax foo
     (lambda (stx) body ...)))

As a convenience form I would suggest
(syntax-transformer (stx) body ...) => (syntax-case-transformer
(lambda (stx) body ...)).  The advantage of this over Mr. Schaefer's
suggestion is that it more closely mirrors the LAMBDA form, and allows
additional arguments to be added more easily.

Furthermore, adding such a form would allow a far more natural
definition of variable transformers:  Rather than using
make-variable-transformer, one would write

(define-syntax foo (syntax-case-variable-transformer
  (lambda (stx) body ...))

with the convenience form

(variable-transformer (stx) body ...) => (syntax-case-variable-transformer
  (lambda (stx) body ...))

David Feuer