From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: master f51f963: Fix some side-effecting uses of make-text-button Date: Sat, 06 Jun 2020 19:00:15 +0000 Message-ID: <87pnacxbnk.fsf@gmail.com> References: <20200604223056.17078.81265@vcs0.savannah.gnu.org> <20200604223058.1850020A26@vcs0.savannah.gnu.org> <87eeqtiy4x.fsf@tcd.ie> <87img51y04.fsf@gmail.com> <5c66eeb5-a513-0443-4316-e41aae118677@cs.ucla.edu> <87img4zjy7.fsf@gmail.com> <170bedfa-7119-4d6a-9d4f-e94ba0f7cc2b@default> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="66521"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "Basil L. Contovounesios" , Paul Eggert , Drew Adams , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 06 21:07:08 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jhe9s-000HBl-6W for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Jun 2020 21:07:08 +0200 Original-Received: from localhost ([::1]:38598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhe9r-0002Tl-9G for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Jun 2020 15:07:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhe3O-0008Gu-6g for emacs-devel@gnu.org; Sat, 06 Jun 2020 15:00:26 -0400 Original-Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:39717) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhe3N-0000u9-3L for emacs-devel@gnu.org; Sat, 06 Jun 2020 15:00:25 -0400 Original-Received: by mail-wr1-x42a.google.com with SMTP id t18so13130398wru.6 for ; Sat, 06 Jun 2020 12:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=wJfxP+7EqfmTBMO/qlYCNFOs9M6Y5Ckiyv8u1HtJKfU=; b=ARKthVxV+UZ4+m928Tqx/l3iI+Yxjh8zD73IIDcH9uUVGH7gJiIqlPEECy5Fl+9bwe 3KavQYBRsRtEfcVZDc83D/8HmjD1iEJNhRKsxBxlHhDW8qXm8YdYS/x4GXINfOCx/MN9 NEk5oJEr4A0nhlvW6xpWpjRwlx97FCNCC664nQ870n0ANxHoVz3/0cZF8zPSSif7l/gU SMC0DZSmT5uVjxNPgrt4+X9LKrNh73FrTPDXrGtRshHYjP29V+erWymh6oYMk5pZchma v/qJDE6ZvBjDmuCAYqlb6GcpZ9scI7r0Jixbrx7VbY5bDQXGu0O7eiNv/jLSMScNE9Zk zobQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=wJfxP+7EqfmTBMO/qlYCNFOs9M6Y5Ckiyv8u1HtJKfU=; b=K2Eq9MKMX6lrMkE4o797ss5/+Yp9eiJNv8j+N/LAGzwM0BZ5wkNmLsENij3oTsCeKQ Ptij+Schkbc0zfpF41GPk0q2Q8ByhlMA4sAb5f9RpVJ6zpK2x5Kx//6trzCxUnf9Rpwl /AyV1IXAWmQ1vM74hfL2TMCTnH6QfmF7BAHZaNo11gx0d2Iyc8eG12/uMvns4D+SRpoK JKaJ/abo8z/gq4o74MENxbSFxNotNQE2QsJECklejKFbaSX8qOAArkS3FM71DOaHr5hV HqJdo0OGg+OIrXsN5QNuLGghXygEysH01laieL6h1WT18cHrB6COugik1GR7DXeIdEo/ RZdQ== X-Gm-Message-State: AOAM5321gQlQxUW4p52i8wcunL9Epi6GugtUYO6+IOplHWlHWfD78O46 aOEBh2I6c5uD7alza00cH8HBlwp7/3E= X-Google-Smtp-Source: ABdhPJz7224TI9Z8wPeq3F/gfUGU0oyK09Sl5v6zg+6BEM5sdaaIKXwl77T/BG8mJs2ZguVyqQxp4Q== X-Received: by 2002:adf:fc4e:: with SMTP id e14mr15385875wrs.348.1591470023038; Sat, 06 Jun 2020 12:00:23 -0700 (PDT) Original-Received: from chametz ([185.220.101.204]) by smtp.gmail.com with ESMTPSA id h7sm16347948wml.24.2020.06.06.12.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jun 2020 12:00:22 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 06 Jun 2020 13:57:42 -0400") Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=pipcet@gmail.com; helo=mail-wr1-x42a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251960 Archived-At: Stefan Monnier writes: >> But going backwards, toward some perhaps unneeded >> optimization, in the direction of systematically >> raising an error when trying to modify text >> properties of a string, is not a good idea, IMO. > > I think there needs to be a clarification here: the issue is about > modifying data (here specifically strings, but the issue applies to all > other such data) that appears as literal in the code. > This issue is not one of optimization (preventing those modifications > would likely impose a slowdown, if anything) but one of detecting usage > that is usually a bug (one that leads to people being utterly > confused by the resulting behavior). I don't see how literal data is special that way. If I expect a function to look at a string argument, but it actually modifies its argument, that's equally confusing. If I modify data that's been used in a hash key, that's even more confusing. If I modify data in an image spec in a Lisp callback from the image backend, Emacs will crash. These cases deserve being thought about, too. How many such bugs have appeared and been difficult to debug since pure space essentially stopped existing when pdumper was introduced? The cost of this isn't negligible; the single bit which I expect will be kept for every string, cons cell, or vector isn't that significant, but so far what's been proposed would be complicated to implement, explain, and use. It would lead to some people developing a false sense of security and others becoming insecure and copying everything needlessly (and dangerously, for cyclic objects). And it would effectively prevent any competing system of mutability, I fear. For example, consider quasi-quoted literals: would those be immutable? No matter what the answer to that question is, would people actually remember?