From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#40693: 28.0.50; json-encode-alist changes alist Date: Sun, 19 Apr 2020 15:14:11 -0700 Organization: UCLA Computer Science Department Message-ID: References: <7b043ea4-2633-45dc-8e7f-79f86ff00d95@cs.ucla.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------D1BD5F742FE72AAB903461C1" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="86619"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cc: 40693@debbugs.gnu.org To: Drew Adams , Ivan Andrus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 20 00:15:13 2020 Return-path: Envelope-to: geb-bug-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 1jQIDZ-000MR9-CY for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Apr 2020 00:15:13 +0200 Original-Received: from localhost ([::1]:48176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQIDY-0006Dq-Aq for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Apr 2020 18:15:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34660 helo=eggs1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQIDQ-0006Cu-Eo for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 18:15:04 -0400 Original-Received: from Debian-exim by eggs1p.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQIDO-0000uA-S2 for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 18:15:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34589) by eggs1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQIDO-0000tR-EN for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 18:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jQIDO-0002BV-8u for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 18:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Apr 2020 22:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40693 X-GNU-PR-Package: emacs Original-Received: via spool by 40693-submit@debbugs.gnu.org id=B40693.15873344628307 (code B ref 40693); Sun, 19 Apr 2020 22:15:02 +0000 Original-Received: (at 40693) by debbugs.gnu.org; 19 Apr 2020 22:14:22 +0000 Original-Received: from localhost ([127.0.0.1]:46131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQICj-00029u-N3 for submit@debbugs.gnu.org; Sun, 19 Apr 2020 18:14:22 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQICh-00029f-74 for 40693@debbugs.gnu.org; Sun, 19 Apr 2020 18:14:20 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1C01D160065; Sun, 19 Apr 2020 15:14:13 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id wT-mSZLKMTU3; Sun, 19 Apr 2020 15:14:12 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1CEC016008E; Sun, 19 Apr 2020 15:14:12 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9eOAESFMZe9g; Sun, 19 Apr 2020 15:14:12 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E4041160065; Sun, 19 Apr 2020 15:14:11 -0700 (PDT) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178676 Archived-At: This is a multi-part message in MIME format. --------------D1BD5F742FE72AAB903461C1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 4/19/20 2:01 PM, Drew Adams wrote: > 'foo returns the symbol foo. Depending on the > context, you can certainly modify the properties of > that symbol - its `symbol-value', `symbol-function', > and `symbol-plist'. Thanks for catching that. I installed the attached further patch to fix that. > The message should be about not _depending_ on a > quoted value returning a new object (e.g. new list > structure). The message should not be that `quote' > never returns a new object. The message is already in the new "Constants and Mutability" section in the emacs-27 branch. No doubt the wording could be improved.... > A constant is not something that _should not_ be > modified. It's something that _cannot_ be modified. This is merely a terminology issue; feel free to come up with better terminology. --------------D1BD5F742FE72AAB903461C1 Content-Type: text/x-patch; charset=UTF-8; name="0001-Fix-mutability-glitches-reported-by-Drew-Adams.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Fix-mutability-glitches-reported-by-Drew-Adams.patch" >From e1d42da0d686e93534ee2abebe79bff95f18cb4d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 19 Apr 2020 15:09:02 -0700 Subject: [PATCH] Fix mutability glitches reported by Drew Adams See Bug#40693#32. * doc/lispref/eval.texi (Self-Evaluating Forms, Backquote): Say that these yield constant conses, vectors and strings, not constant symbols. * doc/lispref/objects.texi (Constants and Mutability): Say that an attempt to modify a constant variable signals an error, instead of saying that it has undefined behavior. --- doc/lispref/eval.texi | 8 ++++---- doc/lispref/objects.texi | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index deb288943a..f33c2faac1 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi @@ -158,8 +158,8 @@ contents unchanged. @end group @end example - A self-evaluating form yields a constant, and you should not attempt -to modify the constant's contents via @code{setcar}, @code{aset} or + A self-evaluating form yields constant conses, vectors and strings, and you +should not attempt to modify their contents via @code{setcar}, @code{aset} or similar primitives. The Lisp interpreter might unify the constants yielded by your program's self-evaluating forms, so that these constants might share structure. @xref{Constants and Mutability}. @@ -704,8 +704,8 @@ Here are some examples: @end example If a subexpression of a backquote construct has no substitutions or -splices, it acts like @code{quote} in that it yields a constant that -should not be modified. +splices, it acts like @code{quote} in that it yields constant conses, +vectors and strings that should not be modified. @node Eval @section Eval diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 98b001afd2..b45eb7ad8a 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -2395,17 +2395,19 @@ somewhere else. Although numbers are always constants and markers are always mutable, some types contain both constant and mutable members. These -types include conses, vectors, and strings. For example, the string +types include conses, vectors, strings, and symbols. For example, the string literal @code{"aaa"} yields a constant string, whereas the function call @code{(make-string 3 ?a)} yields a mutable string that can be changed via later calls to @code{aset}. - A program should not attempt to modify a constant because the + Modifying a constant symbol signals an error (@pxref{Constant Variables}). +A program should not attempt to modify other types of constants because the resulting behavior is undefined: the Lisp interpreter might or might not detect the error, and if it does not detect the error the interpreter can behave unpredictably thereafter. Another way to put -this is that mutable objects are safe to change, whereas constants are -not safely mutable: if you try to change a constant your program might +this is that although mutable objects are safe to change and constant +symbols reliably reject attempts to change them, other constants are +not safely mutable: if you try to change one your program might behave as you expect but it might crash or worse. This problem occurs with types that have both constant and mutable members, and that have mutators like @code{setcar} and @code{aset} that are valid on mutable -- 2.17.1 --------------D1BD5F742FE72AAB903461C1--