From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Is `eval' allowed to modify its argument?
Date: Fri, 13 Nov 2020 18:01:48 -0500 [thread overview]
Message-ID: <jwv7dqouaqq.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 875z693x1z.fsf@web.de
>> > So do we consider that a bug in `thunk-let*'?
>> Yes. Most likely a misuse of `nreverse` or something like that.
> Exactly that, yes. AFAIR I used `nreverse' on purpose: back then I had
> thought it would not matter.
Destructive operations on lists, like `nreverse` or `sort` should (as
a general rule) only ever be used on lists you yourself just constructed
(so you can be (almost) 100% sure you hold the one and only reference to the list
and nobody else will be able to witness the destructiveness).
Using it on something you received as an argument is basically always
a bug, unless it's clearly documented (as is done, for example, in the
doc of `nreverse`).
Stefan
PS: The "almost" above is because in Elisp you can't really be sure of
anything, thanks to things like advice. That's why users of advice
are warned that it's up to them to deal with any problem that may
result of poor interaction between their code and the rest.
next prev parent reply other threads:[~2020-11-13 23:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 21:06 Is `eval' allowed to modify its argument? Michael Heerdegen
2020-11-12 21:18 ` Michael Heerdegen
2020-11-12 22:13 ` Stefan Monnier
2020-11-13 11:29 ` Michael Heerdegen
2020-11-13 14:12 ` Stefan Monnier
2020-11-13 18:56 ` Michael Heerdegen
2020-11-13 23:01 ` Stefan Monnier [this message]
2020-11-13 23:14 ` Drew Adams
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=jwv7dqouaqq.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--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.