
4 Jan
2012
4 Jan
'12
2:39 p.m.
On Tue, Jan 3, 2012 at 3:25 PM, Ryan Davis <ryan@acceleration.net> wrote:
I also recently learned about constantp and just got excited :).
Talking about constantp: it takes as arguments: form &optional environment. Constantness can depend on the environment, e.g. if the form is (m) and its definition is like: (defmacro m (&environment env) (if (foo-p env) :constant-form (non-constant-form))) Therefore you should always pass on environment within macros, so instead of: (defmacro ensure-gethash (key hash-table &optional default) `(... ,(if (constantp default) ..))) use: (defmacro ensure-gethash (key hash-table &optional default &environment env) `(... ,(if (constantp default env) ..))) - Willem