[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macroexpand-all and cl-macrolet
From: |
Stefan Monnier |
Subject: |
Re: macroexpand-all and cl-macrolet |
Date: |
Sun, 18 Aug 2013 22:51:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> Is macroexpand-all not supposed to work with macrolet?
Depends what you mean.
> (progn
> (cl-macrolet
> ((nlet (bindings &rest body)
> `(apply
> (lambda ,(mapcar 'car bindings) ,@body)
> (list ,@(mapcar 'cadr bindings)))))
> (macroexpand-all
> '(nlet ((a 1)
> (b '(10)))
> (* a (car b))))))
> => (nlet ((a 1)
> (b (quote (10))))
> (* a (car b)))
cl-macrolet says that nlet will be bound as a macro during
macroexpansion of
(macroexpand-all
'(nlet ((a 1)
(b '(10)))
(* a (car b))))
But macroexpand-all will not run during the macroexpansion of
that expression. After all, it's a plain function that will only be run
later after its macro-expansion is over.
So macroexpand-all will only get to look at the `nlet' call when that
code is *run* at which point the `nlet' definition provided by macrolet
is "long gone".
Stefan