From: Andreas Schwab <schwab@suse.de>
To: hw <huwei9527@gmail.com>
Cc: 27910-done@debbugs.gnu.org
Subject: bug#27910: 24.5; local-scope; construct list
Date: Tue, 01 Aug 2017 17:46:42 +0200 [thread overview]
Message-ID: <mvmwp6np9y5.fsf@suse.de> (raw)
In-Reply-To: <87h8xrlcmu.fsf@hw.i-did-not-set--mail-host-address--so-tickle-me> (hw's message of "Tue, 01 Aug 2017 20:02:17 +0800")
On Aug 01 2017, hw <huwei9527@gmail.com> wrote:
> Look at this code:
>
> (defun test ()
> "Test"
> (setq a '(A))
> (push 'B a)
> (nreverse a))
>
> (message "%s" (test))
> (message "%s" (test))
>
> The result of the code run on my emacs is:
>
> (A B)
> (B A B)
>
> Since 'a' is a local variable, it is expected to be lke this:
This is irrelevant, nreverse is destructively modifying the literal in
the function:
ELISP> (symbol-function 'test)
(lambda nil "Test"
(setq a
'(A B))
(push 'B a)
(nreverse a))
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
next prev parent reply other threads:[~2017-08-01 15:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 12:02 bug#27910: 24.5; local-scope; construct list hw
2017-08-01 15:46 ` Andreas Schwab [this message]
2017-08-01 16:02 ` Noam Postavsky
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=mvmwp6np9y5.fsf@suse.de \
--to=schwab@suse.de \
--cc=27910-done@debbugs.gnu.org \
--cc=huwei9527@gmail.com \
/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.