[ansi-test-devel] Local function binding shadows global macro
Erik Huelsmann
ehuels at gmail.com
Fri Aug 26 11:23:08 UTC 2011
Hi Sam,
On Thu, Aug 25, 2011 at 11:51 PM, Sam Steingold <sds at gnu.org> wrote:
> > * Erik Huelsmann <ruhryf at tznvy.pbz> [2011-08-25 23:09:05 +0200]:
> >
> > (defmacro var (name &optional value docs)
> > `(defparameter ,name ,@(when value (list value))))
>
> (macroexpand-1 '(var foo))
> ==>
> (DEFPARAMETER FOO) ;
> T
>
> defparameter requires the second argument.
>
> > (defun make-var (the-name))
> >
> > (defun foo (var-ref)
> > (flet ((var (x) (second x)))
> > `(make-var ,(var x))))
>
> do you mean
>
> (defun foo (var-ref)
> (flet ((var (x) (second x)))
> `(make-var ,(var var-ref))))
>
Yup. I did mean that.
> ??
>
> > Any ideas about translating this into a good test to be committed?
>
> I am sorry, it is not clear what the code's intended behavior is.
>
>
Well, the code is a fragment from Parenscript. It's not really trying to
achieve anything, other than to test that the macro expansion for the var
macro isn't triggered. Until a few days ago, the above snipped would break
on compilation with a debugger backtrace showing that the compiler was
trying to expand the VAR macro somewhere mid-code (incorrectly, as it is
used within the scope of the flet which should shadow the global macro VAR.
I hope this explanation helps to get a better picture of what I'm trying to
achieve.
Regards,
Erik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ansi-test-devel/attachments/20110826/a3a58bce/attachment.html>
More information about the ansi-test-devel
mailing list