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: Sat, 2 May 2020 12:35:51 -0700 Organization: UCLA Computer Science Department Message-ID: References: <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> <012e8bc3-df4b-3884-4e54-5fe7ef4248cb@cs.ucla.edu> <37a54ac2-da80-ca35-9c01-38c8e12a4b5f@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="14373"; 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: Dmitry Gutov , Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 02 21:37:14 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 1jUxwo-0003fC-D2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 May 2020 21:37:14 +0200 Original-Received: from localhost ([::1]:44644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUxwn-0007uX-F0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 May 2020 15:37:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUxwd-0007ov-Fe for bug-gnu-emacs@gnu.org; Sat, 02 May 2020 15:37:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUxwc-0001T3-Qh for bug-gnu-emacs@gnu.org; Sat, 02 May 2020 15:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUxwc-0001Sw-Dy for bug-gnu-emacs@gnu.org; Sat, 02 May 2020 15:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jUxwc-0002BP-BQ for bug-gnu-emacs@gnu.org; Sat, 02 May 2020 15:37: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: Sat, 02 May 2020 19:37: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.15884481778335 (code B ref 40671); Sat, 02 May 2020 19:37:02 +0000 Original-Received: (at 40671) by debbugs.gnu.org; 2 May 2020 19:36:17 +0000 Original-Received: from localhost ([127.0.0.1]:53965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUxvt-0002AN-3y for submit@debbugs.gnu.org; Sat, 02 May 2020 15:36:17 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56386) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUxvd-00029Y-EI for 40671@debbugs.gnu.org; Sat, 02 May 2020 15:36:15 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DFB6916007E; Sat, 2 May 2020 12:35:55 -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 qVMSYFm01hEi; Sat, 2 May 2020 12:35:55 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F0A821600DB; Sat, 2 May 2020 12:35:54 -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 vCZxJKvfgSb2; Sat, 2 May 2020 12:35:54 -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 9D08316007E; Sat, 2 May 2020 12:35:54 -0700 (PDT) Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls QWhEcXBNbmQvbXNTRVNORnQ3NkRpTzFaS1FNcjlhbVZQa25qZlBtSklTcWRoZ0IxRApsRWR3 MzRzUk9mNlY4bVp3MHhmcVQ2UEtFNDZMY0ZlZnpzMGtiZzRHT1JmOHZqRzJTZjF0azVlVThN Qml5Ti9iClowM2JLTmpOWU1wT0REUVF3dVA4NGtZTGtYMndCeHhNQWhCeHdiRFZadWR6eERa SjFDMlZYdWpDT0pWeHEya2wKakJNOUVUWXVVR3FkNzVBVzJMWHJMdzYrTXVJc0hGQVlBZ1Jy NytLY3dEZ0JBZndoU In-Reply-To: <37a54ac2-da80-ca35-9c01-38c8e12a4b5f@yandex.ru> 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:179537 Archived-At: >> There's no sense in CLtL in which a mutable >> object must be implemented via a pointer to a value whereas a constant= must not >> be implemented that way. >=20 > The "objects that appear as a constant" are objects to which exist refe= rences > from executable code, and where such references are "constant" (or poss= ibly > constant, since an implementation might opt not to coalesce the values)= . That > why it's about constant references (and objects to which such reference= s exist). I don't understand this point. It sounds like you might be trying to distinguish between constant refere= nces (i.e., pointers that don't change) and constant objects implemented via references (i.e., the pointed-to values don't change). However, whether t= he references themselves are constant is independent of the issue at hand. T= he issue wouldn't change, for example, if Emacs relocated objects so that references were updated regardless of whether the objects' values were co= nstant. >> Whether an object is constant is distinct from whether it's derived fr= om a >> self-evaluating form, because one can have constants that were never d= erived >> from any self-evaluating form. >=20 > Examples? One example is (aset (symbol-name 'car) 0 ?d), which I mentioned a while = ago. Here's a trickier one: (let ((constant-string (aref (symbol-function 'error) 1))) (aset constant-string 0 183) (number-sequence 0 1 0)) This also provokes undefined behavior at the C level while number-sequenc= e is doing its thing; my Emacs dumps core, yours may do something different. I= 'm sure there are other examples. The point is that programs should not modify co= nstants. It would be nice if Emacs reliably signaled these errors and we should be= able to do a better job of that than we're doing now. However, doing a better = job would require interpreter surgery that would be too much for emacs-27. > =C2=A0 A mutable object can become constant if it is part of an express= ion > =C2=A0 that is evaluated >=20 > does add some cases not covered by self-evaluating forms, but those are= more > complex cases (e.g. creating forms programmatically and then passing th= em to > 'eval'), and then the programmer might justifiably be expected to use t= heir > head. The self-evaluating forms case is arguably less obvious. The documentation should not limit itself to self-evaluating forms when discussing this problem area. Although it's OK for the doc to emphasize self-evaluating forms, they are not the whole story here.