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: Sun, 07 Jun 2020 09:31:58 +0000 Message-ID: <878sgzxlv5.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> <87pnacxbnk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="84632"; 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 Sun Jun 07 11:32:59 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 1jhrfm-000Ls4-Q9 for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Jun 2020 11:32:58 +0200 Original-Received: from localhost ([::1]:33220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhrfl-0008VH-RH for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Jun 2020 05:32:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhrfJ-00084f-Nm for emacs-devel@gnu.org; Sun, 07 Jun 2020 05:32:29 -0400 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:46296) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhrfI-0005DJ-OM for emacs-devel@gnu.org; Sun, 07 Jun 2020 05:32:29 -0400 Original-Received: by mail-wr1-x429.google.com with SMTP id x6so14159923wrm.13 for ; Sun, 07 Jun 2020 02:32:28 -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=BGEd6rr4VV0x9jwp9jYZkCcBpoqK+Dsa5PA3WL+mZtA=; b=NpvMCyx8ifBF5nP677U6cXAmli4ZxsnJEKKGsryPY3u7zFYksmHy9tnnQbbUZf8uPs ujkt8Hl7CFblkYgUq5FY34eRozPidAFrfP70L/2qZ9SdS4R4wBd/6kKkLhLZ5zP6vjq7 g+x4JBtT9v0KZe92yUd4OYA6Ai6TBjlszkB+k5DRZ1xAdT9N4ZOOeRFjFHLTMbg2RblX CteABYFATG/SZHiDIbifVMK/kceujNy7J3HEgNdv05cJzYHmd/5nkHxclhcKof8jwUXk Mtzy9PapCaS7chrpmhaRE9XdnK+Er1oSIAFKWrkkZSknjiT1H2woEYQWK+BVj5ksVa6I AsvQ== 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=BGEd6rr4VV0x9jwp9jYZkCcBpoqK+Dsa5PA3WL+mZtA=; b=MsVk984/SjEz+r1Ex7lWj15Igiw9WYBOkEf+iH9zrXg/Eu0+BjTqz/xu+dL5telmCY XP1vDf8SuZPNE6wICcsrUmCQTZJG3B/W7M89NSp8syyMp9o4Vh7OSPGJywKMk7s88qoo AYXGLZbiwfObqB6iLYV4uFwXfcqWLcrKcMMFQD+6IBaoid4Ks+UZ6BJmh18fvXeQ90uI ag5H1EGUklGwoBsoyrYlH01l4JI0nHv3i3L4AGtxqq4sjYkkJGddnHxfipk8UWbcL6jM 50F3jku9dyHjh0Qa6VelrPrZBe0IYVLDn0z2BrwJeT78U3oWaw1Mv/z0L99VQIUcIxP+ f2hQ== X-Gm-Message-State: AOAM530ZZRtu4vJ13lAqtf99Z2ymfBH6VSVYmdh6b8EHvyIMjgO/T2S0 VkMMiavOuX6+/yYSfys5kC76WQ/WAIk= X-Google-Smtp-Source: ABdhPJx6lGrpHCjQHuKDhutB283fA6M6vwRR01ATamP8yWvaw3cP7sE9Mow4ck62cDsOWSvlSkN4Fw== X-Received: by 2002:a5d:4490:: with SMTP id j16mr19616552wrq.276.1591522346994; Sun, 07 Jun 2020 02:32:26 -0700 (PDT) Original-Received: from chametz ([185.220.101.213]) by smtp.gmail.com with ESMTPSA id g18sm18743702wme.17.2020.06.07.02.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2020 02:32:26 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 06 Jun 2020 18:14:29 -0400") Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=pipcet@gmail.com; helo=mail-wr1-x429.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:251999 Archived-At: Stefan Monnier writes: >> If I expect a function to look at a string argument, but it actually >> modifies its argument, that's equally confusing. > > I hate mutability, yes. But mutability of literals amounts to > self-modifying code, which is yet a bit more evil. And, just once in a while, so very useful :-) You're right, though, mutability of literals is a more serious concern than mutability in general. >> 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. > > We agree, but I'm not sure what it is you're suggesting we should do. Mostly: don't make it harder to experiment with mutability by pretending we already have anything like it. > We obviously can't make existing data types unilaterally immutable since > it would break way too much code. Are you suggesting we add new > constructors for "immutable cons", "immutable string", ...? > Or a `set-immutable` function? Not at this point, no. I can describe the code I'm playing with, but it's quite different and I'm not sure it's worth the considerable performance cost... >> 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. > > I'm not exactly sure what has been suggested, to be honest. > Are you referring to the idea of making literal strings immutable? > I'm not sure what is the implementation plan for such a thing. > It seems at least not completely straightforward. I think the issue has been resolved: if I understand correctly, Paul is probably going to propose an actual patch which makes strings immutable, and we can discuss it then. >> 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. > > That makes me think there's been a fairly concrete proposal that has > been made and which I missed (since otherwise, it seems unclear how > you'd get to these conclusions). Can someone point me to it? You're right, we should wait for such a proposal.