all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

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.