[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro expansion: Why doesn't the invoked macro see (let (variables))
Re: Macro expansion: Why doesn't the invoked macro see (let (variables)) from the invoking one?
Wed, 08 Feb 2012 19:05:58 +0100
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux)
Alan Mackenzie <address@hidden> writes:
> 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)
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.
Re: Macro expansion: Why doesn't the invoked macro see (let (variables)) from the invoking one?,
Tassilo Horn <=