[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro Expansion Inconsistency
From: |
Alexander Shukaev |
Subject: |
Re: Macro Expansion Inconsistency |
Date: |
Tue, 16 Dec 2014 23:58:32 +0100 |
>
> (defmacro test (name)
> `(let* ((name ',name)
> (symbol (intern (concat "some" "-" (symbol-name name)))))
> ,symbol))
> ^^^^^^^
>
> The comma operator causes something to be evaluated when the macro is
> expanded, but the `symbol' binding doesn't exist until runtime (at which
> time it exists where the macro expanded, not within the macro's body).
>
> This is another version that will work (notice the lack of quoting):
>
> (defmacro test (name)
> (let ((symbol (intern (concat "some" "-" (symbol-name name)))))
> symbol))
>
Yes, I get it, but then how do I do something like
(defmacro test
(name)
`(let* ((name ',name))
(defvar ,(intern (concat "some" "-" (symbol-name name))))))
but using variable `symbol'?
- Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, Joost Kremers, 2014/12/16
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, John Mastro, 2014/12/16
- Re: Macro Expansion Inconsistency,
Alexander Shukaev <=
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Stefan Monnier, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17