[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro expansion: Why doesn't the invoked macro see (let (variables))
From: |
Tassilo Horn |
Subject: |
Re: Macro expansion: Why doesn't the invoked macro see (let (variables)) from the invoking one? |
Date: |
Wed, 08 Feb 2012 19:05:58 +0100 |
User-agent: |
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux) |
Alan Mackenzie <address@hidden> writes:
Hi Alan,
> One macro FOO binds a let variable, then invokes another macro BAR.
> BAR doesn't see this let variable. Why not? Is there anything I can
> do about this?
>
> (defmacro BAR ()
> (message (if (boundp 'asdf) "asdf" "no asdf"))
> '(message "bar"))
>
> (defmacro FOO ()
> (let (asdf)
> `(BAR)))
It seems first (FOO) expands into (BAR) and at that time asdf is bound,
but then the expansion of (BAR) is again isolated.
It looks like try to create a macro that creates a different expansion
depending on its context. I don't think that's a good idea anyway.
Better add an explicit asdf parameter.
Bye,
Tassilo
Re: Macro expansion: Why doesn't the invoked macro see (let (variables)) from the invoking one?,
Tassilo Horn <=