guile-devel
[Top][All Lists]
Advanced

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

Re: Patch to add (define-syntax (foo bar) ...) support


From: Noah Lavine
Subject: Re: Patch to add (define-syntax (foo bar) ...) support
Date: Sun, 3 Jul 2011 16:44:46 -0400

Hello,

I agree that this is much shorter, but I'm worried about defining the
short syntax in a way that forces you to choose between syntax-rules
and syntax-case. What I mean is that you could just as easily have

(define-syntax (foo bar)
  ...)

expand to

(define-syntax foo
  (syntax-rules ()
    ((_ bar) ...)))

It seems to me that this makes a somewhat arbitrary choice, which
isn't great. I'd rather see some way to unify the two possibilities,
but I don't know what that would be. There's also the possibility of
making it expand to

(define-syntax foo
  (syntax-case tmp ...
    ((bar) ...)))

because it is more analogous to how regular procedures work.

I don't know what the right choice is, but it's a good point that
there probably should be something.

Noah

On Sun, Jul 3, 2011 at 4:19 PM, Chris K. Jester-Young <address@hidden> wrote:
> Hi there,
>
> When writing syntax-case macros, often one would write:
>
>    (define-syntax foo
>      (lambda (bar)
>        (syntax-case bar ...)))
>
> This seems overly long-winded; it would be preferable to be able to
> write, instead:
>
>    (define-syntax (foo bar)
>      (syntax-case bar ...))
>
> Attached is a patch that implements that. Note that there is nothing
> original in this patch---it's just a straight copy-and-paste of the
> "define" version immediately above, except changing define-form to
> define-syntax-form---so there should be nothing controversial from a
> correctness and/or copyright point of view.
>
> Let me know what you think.
>
> Many thanks,
> Chris.
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]