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

Re: isn't computation-rules redundant?

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

On Fri, 26 Mar 2004, Alex Shinn wrote:

> ... and both versions are easier to read if you actually include the
> "and" in the LHS, sorry about that:
>    (define-syntax-computations and ()
>      (and) #f
>      (and x) x
>      (and x y z ...) (if x (and y z ...) #f))

I agree that this is more readable.  However, there may be some value in
mirroring the syntax-rules bracketing, if only to avoid confusion by those
familiar with the latter.

One rationale for the current decoupling of the defining form from the
transformer (as in syntax-rules) is that
one has a uniform way of denoting a transformer, whether it is bound to a
name using define-syntax, bound using let(rec)-syntax, or used
anonymously.  Your proposal, while more brief, conflates declaring the
transformer and binding it, and only in define forms but not
let(rec)-forms - in the latter you still have to write it out the long

I have another idea: instead of using define-syntax, introduce a
form DEFINE-TRANSFORMER which will handle both syntax-rules and
syntax-computations, and which can be portable extended to handle other
kinds of tranformers should the need arise in future.  So one would write

   (define-transformer name
     (syntax-rules (...)  ...))

   (define-transformer name
     (syntax-computations (...) ...))

   (define-transformer name
     (lambda (stx) (syntax-case stx (...)  ...)

and so on.  The same goes for LET-TRANSFORMER and LETREC-TRANSFORMER.