From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.help
Subject: Re: Plist-put changes literal argument
Date: Sat, 5 Sep 2020 17:53:52 +0200
Message-ID:
References: <30E631BA-6845-43C1-AB5E-4C02C4F44780@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
logging-data="27892"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: help-gnu-emacs
To: Yuan Fu
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 05 17:54:28 2020
Return-path:
Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.92)
(envelope-from )
id 1kEaWK-0007BZ-HJ
for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Sep 2020 17:54:28 +0200
Original-Received: from localhost ([::1]:45260 helo=lists1p.gnu.org)
by lists.gnu.org with esmtp (Exim 4.90_1)
(envelope-from )
id 1kEaWJ-0007IK-Il
for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Sep 2020 11:54:27 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47732)
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1kEaVz-0007Hn-6P
for help-gnu-emacs@gnu.org; Sat, 05 Sep 2020 11:54:07 -0400
Original-Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:36705)
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from )
id 1kEaVx-00079H-Hm
for help-gnu-emacs@gnu.org; Sat, 05 Sep 2020 11:54:06 -0400
Original-Received: by mail-ot1-x32d.google.com with SMTP id 109so8668676otv.3
for ; Sat, 05 Sep 2020 08:54:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc:content-transfer-encoding;
bh=Tm0KTDaLiK6IMbDaTQqYMOxqLvrPfrUq/s+Q4r/aho8=;
b=YD42jIdsnEZn1Fo2Uh2MxVzm4Sd4B0TzRxx+6BSr8IChoOTsVXJ+ulRHSA6850NE0K
1u7ABCi1WOhdtGEnqXiOCsCIB8Re4jkt5Mf9uE4JbBsTolCax50TUB5T7zSVHsz6v2ZC
JdFZsPMHr6X5ZjkueqRLEWT9oPSp2zlHH+1Xx4V/Sh9iFOPfXLRKUGJJLKihUiK47qLm
A5vnYRRjDgR/eOdpyh4JoqTDMiIOuIl7TlMnxPSQgC2neem7GSHrBvefKXevaO+AXeeb
CLPJYjwWC41orpQEVW9hrYb1IxKESKZuN2A5St0516EmJaJmbqNupRaIoXSRrqs/9CPb
mYyA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc:content-transfer-encoding;
bh=Tm0KTDaLiK6IMbDaTQqYMOxqLvrPfrUq/s+Q4r/aho8=;
b=nGnyLmZ9O9gwYMhmrnGIUkU/hUloloqAO+OzTV36LnhbbztbAsHRkuBCG/btilPycj
a3C8pRLVdZdiPaVR7bS9+Xx0d3/dF0+VlelBhiFpvOnpuPo/YcLvSMza0jlrdzhlOP9k
ITBhOdKFEMiOvEcTC+neCnnS8WrMVS6yywLq4xh7dV9IBGlYPlGROo7w4AYB6LdWgep8
244fUlwN3W8smAicyjtt0NQu4CXtIYMik9msytz+45zk1PypOWskyL4qF4NkRlkonS41
1BWeVcYMj6EeadMte6bdeFn6WOr9memnmjNJ1OCIh8fhWEEhfvNHyalZVU/CFOyuNHbp
HrHw==
X-Gm-Message-State: AOAM531plHN3NP782GES8bp8R1PaS9SZKIgH8Au3Rtk/LB3bnKYFVKDJ
pdRq/SZqsNZIY+loyEYac08Eue+IlUaKdxGBq2Y=
X-Google-Smtp-Source: ABdhPJzfFSysg4fTEr9xhcH1e438JN6bnh/uUA5d8au+Y8qWwp+9U6v64yeYwqTeJAt0Eu5/hPguhflJ+ZA8rqb61bs=
X-Received: by 2002:a9d:20c1:: with SMTP id x59mr9167920ota.36.1599321243385;
Sat, 05 Sep 2020 08:54:03 -0700 (PDT)
In-Reply-To:
Received-SPF: pass client-ip=2607:f8b0:4864:20::32d;
envelope-from=p.stephani2@gmail.com; helo=mail-ot1-x32d.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
That's all we know.
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: Users list for the GNU Emacs text editor
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "help-gnu-emacs"
Xref: news.gmane.io gmane.emacs.help:123976
Archived-At:
Am Do., 3. Sept. 2020 um 01:59 Uhr schrieb Yuan Fu :
>
>
>
> > On Sep 2, 2020, at 7:55 PM, Yuan Fu 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=E2=80=99t copy arguments=
?
Lists (actually all values except fixnums/small integers) are always
passed by reference; or, in other words, a list argument actually
contains a pointer to the list, not the list itself. Copying the
pointer doesn't copy the list.