[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: defmacro* usage
From: |
Stefan Monnier |
Subject: |
Re: defmacro* usage |
Date: |
Wed, 02 Nov 2011 09:04:07 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) |
> I have an error with following recipe:
> #+BEGIN_SRC lisp
> (defmacro* test1 (&key (lang 'french))
> `(case ,lang
> (french (message "Bonjour"))
> (english (message "Hello"))))
[...]
> As you can see, the quoted default argument 'french cause an error with
> the defmacro* and work fine with the defun*.
The error is not from defmacro* but from the code you generated using defmacro*.
> Is it a bug or i misunderstand something?
A misunderstanding. Think harder about what your macro does. E.g. try
(macroexpand '(test1 :lang 'toto)) and (macroexpand '(test1)).
During macroexpansion, your `lang' is not supposed to hold a "language
value" but "a Lisp expression that will evaluate to a language value".
Stefan