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: Wed, 22 Apr 2020 10:21:51 -0700 Organization: UCLA Computer Science Department Message-ID: <9e6c138d-cb9f-6075-34df-a8d1d931343b@cs.ucla.edu> References: <83tv1finob.fsf@gnu.org> <1E9E4C19-37C2-4E24-91B7-8101F9CFBF35@acm.org> <527dc4b5-3176-38b5-f2c1-1483ffc814a1@cs.ucla.edu> <87k12b6sv2.fsf@web.de> <2225099d-16e1-645d-0342-a054da53363f@cs.ucla.edu> <87a7376nv9.fsf@web.de> <99d7a8f9-7732-e1e3-414e-aabbea4433ac@cs.ucla.edu> <87o8rnasfk.fsf@web.de> 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="109924"; 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: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 40671@debbugs.gnu.org, ke.vigouroux@laposte.net To: Drew Adams , Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 22 19:22:15 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 1jRJ4f-000SR4-2S for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Apr 2020 19:22:13 +0200 Original-Received: from localhost ([::1]:54814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRJ4e-0006HJ-70 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Apr 2020 13:22:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33746) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRJ4V-0006Ge-I6 for bug-gnu-emacs@gnu.org; Wed, 22 Apr 2020 13:22:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRJ4V-0001f9-0s for bug-gnu-emacs@gnu.org; Wed, 22 Apr 2020 13:22:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRJ4U-0001eu-LJ for bug-gnu-emacs@gnu.org; Wed, 22 Apr 2020 13:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jRJ4U-0000aH-G0 for bug-gnu-emacs@gnu.org; Wed, 22 Apr 2020 13:22: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: Wed, 22 Apr 2020 17:22: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.15875761212238 (code B ref 40671); Wed, 22 Apr 2020 17:22:02 +0000 Original-Received: (at 40671) by debbugs.gnu.org; 22 Apr 2020 17:22:01 +0000 Original-Received: from localhost ([127.0.0.1]:53111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRJ4S-0000a2-Pd for submit@debbugs.gnu.org; Wed, 22 Apr 2020 13:22:00 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:43792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRJ4R-0000Zo-0g for 40671@debbugs.gnu.org; Wed, 22 Apr 2020 13:21:59 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F3B54160017; Wed, 22 Apr 2020 10:21:52 -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 oI47bhpAbL2W; Wed, 22 Apr 2020 10:21:52 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 46DBD160094; Wed, 22 Apr 2020 10:21:52 -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 aZT-D_4auKgp; Wed, 22 Apr 2020 10:21:52 -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 0B42B160017; Wed, 22 Apr 2020 10:21:52 -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:178814 Archived-At: On 4/19/20 10:54 PM, Drew Adams wrote: > A mutable object cannot be changed to a constant Sure they can. This idea is common in other languages, e.g., see Object.freeze method in JavaScript. There's no reason Emacs Lisp can't use the idea. >> +A mutable object can become constant if it is passed to the >> +@code{eval} function, > > How so? What's an example? (let ((x (make-string 1 ?a))) (eval `(progn (defun foo () (let ((a ,x)) (aset x 0 ?b) (list a "a" (equal a "a")))) (byte-compile 'foo) (foo)))) This code is not well-formed because it modifies the string x after passing it to eval (such strings should be constant). As a result, the behavior of the program is unpredictable. On master it currently yields ("b" "b" t) but there's no guarantee of this.