From: Xue Fuqiao <xfq.free@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: About Repeated Expansion
Date: Sun, 30 Dec 2012 14:30:07 +0800 [thread overview]
Message-ID: <20121230143007.b1ea8aa043c9caf92ceb736f@gmail.com> (raw)
The GNU Emacs Lisp manual(http://www.gnu.org/software/emacs/manual/html_node/elisp/Repeated-Expansion.html#Repeated-Expansion) says:
Here is an example of how such side effects can get you into trouble:
(defmacro empty-object ()
(list 'quote (cons nil nil)))
(defun initialize (condition)
(let ((object (empty-object)))
(if condition
(setcar object condition))
object))
If initialize is interpreted, a new list (nil) is constructed each time initialize is called. Thus, no side effect survives between calls. If initialize is compiled, then the macro empty-object is expanded during compilation, producing a single “constant” (nil) that is reused and altered each time initialize is called.
It says if `initialize' is compiled, the (nil) will be reused and altered each time `initialize' is called. But there is no expression that alters `empty-object', why will it be altered?
--
Best regards.
next reply other threads:[~2012-12-30 6:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-30 6:30 Xue Fuqiao [this message]
2012-12-30 9:10 ` About Repeated Expansion Thien-Thi Nguyen
2012-12-30 10:06 ` Xue Fuqiao
2012-12-30 15:16 ` Thien-Thi Nguyen
2012-12-30 22:49 ` Xue Fuqiao
2012-12-30 23:51 ` Thien-Thi Nguyen
2012-12-30 17:07 ` Drew Adams
2012-12-30 22:59 ` Xue Fuqiao
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121230143007.b1ea8aa043c9caf92ceb736f@gmail.com \
--to=xfq.free@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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.