From: Joost Kremers <joost.m.kremers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Macro Expansion Inconsistency
Date: 16 Dec 2014 21:10:18 GMT [thread overview]
Message-ID: <slrnm917tq.h18.joost.m.kremers@j.kremers4.news.arnhem.chello.nl> (raw)
In-Reply-To: mailman.16228.1418763453.1147.help-gnu-emacs@gnu.org
Alexander Shukaev wrote:
> (defmacro test
> (name)
> `(let* ((name ',name)
> (symbol (intern (concat "some" "-" (symbol-name name)))))
> ,symbol))
>
> Running
>
> (test xxx)
>
> reports error: (void-variable symbol).
>
> What?
>
> Refactoring to
>
> (defmacro test
> (name)
> `(let* ((name ',name))
> ,(intern (concat "some" "-" (symbol-name name)))))
>
> and running
>
> (test xxx)
>
> works as expected.
>
> Could anybody clarify what's going on? Thanks.
Just consider when exactly the different parts of your macro are
evaluated. When is something that is quoted in the definition evaluated?
And when is something that is comma-escaped evaluated? Then look
carefully at what is quoted and what is comma-escaped. You'll see that
in the first version, something doesn't match.
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
next parent reply other threads:[~2014-12-16 21:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.16228.1418763453.1147.help-gnu-emacs@gnu.org>
2014-12-16 21:10 ` Joost Kremers [this message]
2014-12-16 21:25 ` Macro Expansion Inconsistency Alexander Shukaev
2014-12-16 21:46 ` John Mastro
2014-12-16 22:58 ` Alexander Shukaev
2014-12-16 23:14 ` Alexander Shukaev
2014-12-17 2:19 ` Alexander Shukaev
2014-12-17 10:04 ` Nicolas Richard
2014-12-17 14:03 ` Alexander Shukaev
2014-12-17 14:20 ` Stefan Monnier
2014-12-17 14:34 ` Alexander Shukaev
2014-12-17 14:21 ` Nicolas Richard
2014-12-17 14:52 ` Alexander Shukaev
2014-12-17 14:58 ` Nicolas Richard
2014-12-17 15:14 ` Alexander Shukaev
[not found] ` <mailman.16290.1418825041.1147.help-gnu-emacs@gnu.org>
2014-12-17 15:53 ` Barry Margolin
2014-12-17 16:01 ` Alexander Shukaev
[not found] ` <mailman.16262.1418782759.1147.help-gnu-emacs@gnu.org>
2014-12-17 3:03 ` Rusi
2014-12-17 9:21 ` Nicolas Richard
2014-12-16 23:20 ` John Mastro
[not found] ` <CAKu-7WzgoHH=zM_jxeVGMwzAne88nAoCUsLKQv9zUYo_amsjNg@mail.gmail.com>
2014-12-17 3:34 ` John Mastro
2014-12-17 3:41 ` John Mastro
2014-12-16 23:30 ` Stefan Monnier
2014-12-16 20:57 Alexander Shukaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=slrnm917tq.h18.joost.m.kremers@j.kremers4.news.arnhem.chello.nl \
--to=joost.m.kremers@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).