all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* About Repeated Expansion
@ 2012-12-30  6:30 Xue Fuqiao
  2012-12-30  9:10 ` Thien-Thi Nguyen
  2012-12-30 17:07 ` Drew Adams
  0 siblings, 2 replies; 8+ messages in thread
From: Xue Fuqiao @ 2012-12-30  6:30 UTC (permalink / raw)
  To: help-gnu-emacs

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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-12-30 23:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-30  6:30 About Repeated Expansion Xue Fuqiao
2012-12-30  9:10 ` 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

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.