[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nested macros
From: |
Lynn Winebarger |
Subject: |
Re: Nested macros |
Date: |
Fri, 30 Aug 2002 18:33:05 -0500 |
On Friday 30 August 2002 18:11, Wolfgang Jährling wrote:
> I have a problem with nested macros. The following code illustrates it:
>
> (use-modules (ice-9 syncase))
>
> (define-syntax inner
> (syntax-rules ()
> ((inner FOO)
> (FOO FOO FOO))))
>
> (define-syntax outer
> (syntax-rules ()
> ((outer (BAR1 BAR2 BAR3))
> (list BAR1 BAR2 BAR3))))
>
> (outer (inner 'baz))
>
> I expected the last line to expand into
>
> (outer ('baz 'baz 'baz))
>
> and from that into:
>
> (list 'baz 'baz 'baz)
>
> This does not happen. The outer macro is expanded first, which results
> in "invalid syntax", as "outer" expects three expressions in the
> perentheses, but there are only two.
Guile does have problems with macros, but this behaviour is correct.
Macros are always expanded "head first".
>
> Does anyone have an idea what I could do to reach my goal?
I'm afraid I can't help you on your actual question.
Lynn
- Nested macros, Wolfgang Jährling, 2002/08/30
- Re: Nested macros,
Lynn Winebarger <=