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#40671: [DOC] modify literal objects Date: Sun, 19 Apr 2020 13:39:29 -0700 Organization: UCLA Computer Science Department Message-ID: <57532862-f6ec-84b6-13af-8a8985366ff0@cs.ucla.edu> References: <87v9lzmdrw.fsf@laposte.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="90366"; 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: Kevin Vigouroux , 40671@debbugs.gnu.org To: Drew Adams , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 19 22:40:10 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 1jQGja-000NMm-3v for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Apr 2020 22:40:10 +0200 Original-Received: from localhost ([::1]:47498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQGjZ-0003rE-72 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Apr 2020 16:40:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39966 helo=eggs1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQGjT-0003r4-8g for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 16:40:03 -0400 Original-Received: from Debian-exim by eggs1p.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQGjS-0003nt-Oi for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 16:40:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34538) by eggs1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQGjS-0003nF-BN for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 16:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jQGjS-0008OY-2P for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 16:40: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 20:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40671 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 40671-submit@debbugs.gnu.org id=B40671.158732877832235 (code B ref 40671); Sun, 19 Apr 2020 20:40:02 +0000 Original-Received: (at 40671) by debbugs.gnu.org; 19 Apr 2020 20:39:38 +0000 Original-Received: from localhost ([127.0.0.1]:46084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQGj4-0008Nq-71 for submit@debbugs.gnu.org; Sun, 19 Apr 2020 16:39:38 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQGj3-0008Nd-5R for 40671@debbugs.gnu.org; Sun, 19 Apr 2020 16:39:37 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EE0B4160065; Sun, 19 Apr 2020 13:39:30 -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 6P3Uj0Gd9iNm; Sun, 19 Apr 2020 13:39:30 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 11479160068; Sun, 19 Apr 2020 13:39:30 -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 TcES3BQzhRZJ; Sun, 19 Apr 2020 13:39:29 -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 CD1DA160065; Sun, 19 Apr 2020 13:39:29 -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:178668 Archived-At: On 4/18/20 2:54 PM, Drew Adams wrote: > "should be applied only to @dfn{mutable} lists, > that is, lists constructed via @code{cons}, > @code{list} or similar operations." > > That's not a usual meaning of "mutable". Your > "that is" makes clear what you mean, sort of, I > suppose. That part is clear enough, but it's > not a good "definition" of "mutable". > > It's about code that always creates new list > structure, versus code that might create new > list structure only sometimes (e.g. the first > time it's encountered). I think we're mostly in agreement here, it's just that it can be difficult to state things clearly in a reference manual. Let me try to explain a bit further. As far as Elisp is concerned, it's OK to apply destructive operations to list structures that are created only sometimes (e.g., the first time it's encountered), so long as these structures have been created dynamically by the program. That is, the key notion is not whether the program is implementing hash-consing on its own (where it's a bad idea to modify already-existing structures but is valid as far as Elisp is concerned); the key notion here is whether the program is diving into the Lisp interpreter's data structures and attempting to change those data structures on the fly (the program shouldn't do that, as the results are unpredictable and Emacs might crash). > A quoted list, which you call "constant", is in > fact mutable in some contexts. Yes, but we cannot easily document where and when those contexts might be, and it would be a disservice to our users if we tried to document what happens exactly, partly because of the complexity and partly because the byte-compiler might change in the future. Instead, we should simply say that one should not modify the data structures that quoted lists return. > An immutable list would be one you couldn't ever > change - it would truly be a constant. That can > be true for the result of byte-compiling a quoted > list. We can talk about the distinction between a "true constant" and a "constant" in an introductory section, but in the rest of the manual it's simpler to merely distinguish between constant objects (which the program should not change) and mutable objects (which the program can change). That is, in most of the manual there's no reason to distinguish between the two: modifying a constant is trouble, and programs shouldn't do it. In the introductory section we can talk about what happens if programs try to modify a constant anyway. > "However, the other arguments (all but the last) > must be mutable lists." > > "MUST" means you CANNOT do otherwise. I changed it to "should". > BTW, "a quoted constant list" is a bit poorly > worded, as well. I changed that to "constant list". > FWIW, Common Lisp doesn't talk about mutable > or immutable lists (or other objects): > > "The consequences are undefined if literal > objects (including quoted objects) are > destructively modified." > > Undefined. They CAN sometimes be destructively > modified. Yes, that's the idea I'm trying to capture here as well, with the changes I installed today. Thanks for your comments.