unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Plist-put changes literal argument
@ 2020-09-02 23:55 Yuan Fu
  2020-09-02 23:59 ` Yuan Fu
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2020-09-02 23:55 UTC (permalink / raw)
  To: help-gnu-emacs

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



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

end of thread, other threads:[~2020-09-06 15:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-02 23:55 Plist-put changes literal argument Yuan Fu
2020-09-02 23:59 ` Yuan Fu
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

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).