From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#40671: [DOC] modify literal objects Date: Sat, 2 May 2020 04:07:48 +0300 Message-ID: References: <530d3597-aaaa-f019-bafa-8229d13e7248@yandex.ru> <60b88f52-c50d-c57a-9ce5-495e6157d36e@cs.ucla.edu> <0721d8c1-4fe3-335c-7dbc-171487cb648a@yandex.ru> <6d1015da-0dc1-376c-f84b-5e3ee3149213@cs.ucla.edu> <286139d2-bbe1-2d5a-bec1-f781666376f1@yandex.ru> <10b89e6f-6fa6-f855-65b6-3361a74472d3@cs.ucla.edu> <8542efe2-c4a6-1da5-2513-7ffcaa6c4ec9@yandex.ru> <293d0eab-4617-08fe-aafa-d6841a750af0@cs.ucla.edu> <4085994e-f42d-b90f-9c86-ad42689bbff2@yandex.ru> <9cfc3b63-7df6-145a-8a78-e3320b6d3861@cs.ucla.edu> <72399223-0ab5-dbe4-5027-d929450a4df0@yandex.ru> <1a2d0454-baa4-9831-0e2c-4411eda1c2fe@yandex.ru> <278a1350-8b9e-4f3b-854a-723d578129f3@default> <6cbe3c10-6d81-f2be-30d7-17096b3f3517@yandex.ru> 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="74432"; 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: Michael Heerdegen , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , ke.vigouroux@laposte.net, 40671@debbugs.gnu.org, Richard Stallman To: Paul Eggert , Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 02 03:08: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 1jUgdY-000JEu-NW for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 May 2020 03:08:12 +0200 Original-Received: from localhost ([::1]:39098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUgdX-0005Xv-BG for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 May 2020 21:08:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUgdP-0005TS-B5 for bug-gnu-emacs@gnu.org; Fri, 01 May 2020 21:08:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUgdO-0003xH-I1 for bug-gnu-emacs@gnu.org; Fri, 01 May 2020 21:08:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39403) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUgdO-0003wK-5B for bug-gnu-emacs@gnu.org; Fri, 01 May 2020 21:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jUgdN-0004ju-V5 for bug-gnu-emacs@gnu.org; Fri, 01 May 2020 21:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 May 2020 01:08:01 +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.158838167918210 (code B ref 40671); Sat, 02 May 2020 01:08:01 +0000 Original-Received: (at 40671) by debbugs.gnu.org; 2 May 2020 01:07:59 +0000 Original-Received: from localhost ([127.0.0.1]:50949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUgdL-0004jd-BR for submit@debbugs.gnu.org; Fri, 01 May 2020 21:07:59 -0400 Original-Received: from mail-wm1-f52.google.com ([209.85.128.52]:55897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUgdJ-0004jP-31 for 40671@debbugs.gnu.org; Fri, 01 May 2020 21:07:57 -0400 Original-Received: by mail-wm1-f52.google.com with SMTP id e26so1861969wmk.5 for <40671@debbugs.gnu.org>; Fri, 01 May 2020 18:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mb3Pzf5ystzK8PTmeygZwByo/F9Xwg8j5vttJTy4918=; b=iyhb94Xu8Ec7v48k7YqiQFqRVEts00PDpd4B3Ptp/nhZouK56gqTK0mGR/duEhTXQj xsYd8G6EJ0tHlx9tVKJbQh63/JbBp3QTDbQijP9do26LYs7a53neZd3t49RA7ociNHP6 I9QvLpVmrOLARFx1FAZGdyF4dvpQZ9360RBYh0RPYdMqJwIDCIDWc+Nj8oiWYMq2GIJg DWvwkig4onxxyUYjaeENxpRdkqJL7YocnteDXAtYsTZDD1N+HQyKX91rqHFqjY2BR6Oa WpmYiRHl93Y2ouG1Z4W3cM9Z+xZDzIwPxNYqvRnEEXMD6O3JVKBsAJC5uTIxTgdRyAvs elLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mb3Pzf5ystzK8PTmeygZwByo/F9Xwg8j5vttJTy4918=; b=HfVTqxs9QlJreNyv91lOyfThaT23BSEl/2wq3p4hrOfz8cHu+D+FXVAFU4aAIEIHKQ KGWgtnzn8cocPgmiIXog8TJJ0xY5rNsU3ZSUC0V6NZdo83f9sm5a0mwEjqSE3SNTiCvX FRtMsBkIzTSO96YPlPoIM85BG72VwAmXgePvumV3tr38XolJumKSkFduqyOC5TLx+/Lt Xorc8hsBVd/JW+Iwp0pyyXNtljzaHA6oDl2NJLrlm3C/hKJR7di/vkhZOftHOR5iXg/X TBm1GDHImpoi/f/ZVVpG7B6Sfui4LXe7+3DEDJ/vni9kRug0HWNPVz1zQ/Cp6XBccWjs 1Juw== X-Gm-Message-State: AGi0Pua4/6cOzzy3r90p3xqhiODoSpSaIB/YhKanAi9BPsk0RY5IKFk5 +C3SMKGZ+mFeMXGLZ2VoO5I= X-Google-Smtp-Source: APiQypJZ0WslCdFQXllSTRA8nlx6Ph0nXiG1Ff03G6wUN3Thylwk92RWOI1i1rVULIhDYhlJ7o0x0Q== X-Received: by 2002:a1c:44d7:: with SMTP id r206mr2052636wma.101.1588381671187; Fri, 01 May 2020 18:07:51 -0700 (PDT) Original-Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id f83sm1808805wmf.42.2020.05.01.18.07.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 May 2020 18:07:50 -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:179473 Archived-At: On 02.05.2020 00:40, Paul Eggert wrote: >> As Drew pointed out (and if I understood this correctly), the above >> specification leads to implementations that do raise an error when someone tried >> to modify such a value. > > Although those implementations conform to the Common Lisp spec, that's because > the spec explicitly says such behavior is undefined - which means > implementations can signal an error, dump core, or do whatever else they want. > See , which uses > "should" in the same sense the emacs-27 elisp manual uses "should". I suppose so. > When this book specifies that it "is an error" for some situation to occur, this > means that: > > * No valid Common Lisp program should cause this situation to occur. > > * If this situation occurs, the effects and results are completely undefined as > far as adherence to the Common Lisp specification is concerned. > > * No Common Lisp implementation is required to detect such an error. Of course, > implementors are encouraged to provide for detection of such errors wherever > reasonable. > > This is not to say that some particular implementation might not define the > effects and results for such a situation; the point is that no program > conforming to the Common Lisp specification may correctly depend on such effects > or results. Indeed. I took a longer look around the CLtL, to see how the term "constant" is used there, though. Some phrases: --- ...it is an error to destructively modify any object that appears as a constant in executable code, whether as a self-evaluating form or within a quote special form ...to specify what objects can be in compiled constants... quoted constants in it are similar in this sense to quoted constants in the corresponding source code An object may be used as a quoted constant... Some types of objects, such as streams, are not supported in constants processed by the file compiler. Such objects may not portably appear as constants in code processed with compile-file. The following terms are used throughout this section. The term constant refers to a quoted or self-evaluating constant, not a named constant defined by defconstant. Two objects are similar as a constant if and only if they are both of one of the types listed below and satisfy... Two conses are similar as constants if the values of their respective car and cdr attributes are similar as constants. (Then comes the description of "similar as constants" values being coalesced in compiled code). --- CL's terminology seems fairly old by today's standards, but it looks like they were grasping for words, just as we are now. They very rarely use the phrase "constant objects", however. Instead, it's almost always "objects that appears as a constant [in code]", "object ... used as a quoted constant", "object may not ... appear as constants in code", "objects are similar as a constant". IOW, it's the difference between constant values and constant pointers to [mutable] values. And the users are advised not to change the objects that "appear as constants"/[play the role of constants]/[are the values of constants] in executable code. And there is no juxtaposition of "mutable objects" vs "constant objects" anywhere in there, with "constant" defined like that, which is the part of our new documentation that really got me into this discussion. So the section "Constants and Mutability", even though it has valuable information, could use a full rewrite. And could probably move to end of the "Self-Evaluating Forms" section. I'm also not sure it's a good idea to add too much explanations to the introduction featuring phrases like "a list that is part of the program and bad things could happen if we tried to change part of the program while running it", so I'd keep the changes in the examples (the ones I looked at look sensible), but remove most of the explanations. Moreso that they are using the phrases "mutable values" and "constant values". Some short explanation could say that it's a bad idea to modify a quoted form (and then reference "Self-Evaluating Forms"). I can try to make a patch, but at this point is would consist mostly of deletions.