From: Yuan Fu <casouri@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Plist-put changes literal argument
Date: Wed, 2 Sep 2020 19:59:38 -0400 [thread overview]
Message-ID: <F64BE28B-8AA0-46E4-8B69-7C5B1D3C67F1@gmail.com> (raw)
In-Reply-To: <30E631BA-6845-43C1-AB5E-4C02C4F44780@gmail.com>
> On Sep 2, 2020, at 7:55 PM, Yuan Fu <casouri@gmail.com> wrote:
>
> I found plist-put changes the literal argument I pass to a function:
>
> (defun test ()
> (test-2 '(:a b)))
>
> (defun test-2 (form)
> (print form)
> (plist-put form :a 'c)
> nil)
>
> (progn (test) (test))
>
> (:a b)
>
> (:a c)
> nil
>
> I thought Elisp is pass-by-copy? Is this expected?
>
> P.S., (setf (alist-get )) does the same, I guess this IS expected?
>
> Yuan
I also tried setcar, same result. So Elisp doesn’t copy arguments?
Yuan
next prev parent reply other threads:[~2020-09-02 23:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 23:55 Plist-put changes literal argument Yuan Fu
2020-09-02 23:59 ` Yuan Fu [this message]
2020-09-03 0:18 ` Yuan Fu
2020-09-03 0:53 ` Noam Postavsky
2020-09-05 15:55 ` Philipp Stephani
2020-09-06 15:23 ` Yuan Fu
2020-09-05 15:53 ` Philipp Stephani
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=F64BE28B-8AA0-46E4-8B69-7C5B1D3C67F1@gmail.com \
--to=casouri@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).