From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: 31395511: =?utf-8?Q?=22Don=E2=80=99t?= attempt to modify constant strings" Date: Thu, 04 Jun 2020 12:11:00 +0100 Message-ID: <87lfl3f5mj.fsf@tcd.ie> References: <871rmvn7ge.fsf@gmail.com> <87lfl36abx.fsf@gmail.com> <1abe5965-b48e-6dee-1516-c5c233f09d01@cs.ucla.edu> <87d06f5m2c.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="120736"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Paul Eggert , =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= , emacs-devel To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 04 13:11:41 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 1jgnmf-000VJ4-5E for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Jun 2020 13:11:41 +0200 Original-Received: from localhost ([::1]:40686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgnme-0003yc-6j for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Jun 2020 07:11:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgnm5-00037E-KK for emacs-devel@gnu.org; Thu, 04 Jun 2020 07:11:05 -0400 Original-Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:35343) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgnm4-00069l-0S for emacs-devel@gnu.org; Thu, 04 Jun 2020 07:11:05 -0400 Original-Received: by mail-wr1-x430.google.com with SMTP id x14so5646209wrp.2 for ; Thu, 04 Jun 2020 04:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=IOuNNfjQjSKeoSPsKFx9W+GmgAeOacV03615T18wTL4=; b=MzePvnWVSF6yXmnBHsaTk1z9RBo2xHao1Uwjqds1jl5guMR20dj1kf9wuoQdFp7dDh E3O/XrM0gWLI5XF6cwem0RuI2Db4pAsFS4NweoiFr5nB+JnbrMh6xrAicJFLkfjALlbP hEXSB8txbA0JZU/Tyh3rvg+LJdR4+v4s9fWU692bK2EZoNJenERyoP7xM3Jglt1x1Sq2 kRoMXfGa2fUG3rPphStdZsHDWaWGgUte7pvBcib+9G3Hkhou3ZmO7BLowEeWLQrjqRES lfDb3Dus0M3zwovtv0ZKZFEs/ixfsAdHxd3eOj6gVNLA/y9I8QRhYHbMfA/cmSVh6pEz 8mGg== 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=IOuNNfjQjSKeoSPsKFx9W+GmgAeOacV03615T18wTL4=; b=OfcyMHyIdL4t+Gdc4l4/GVrwLc+EThm0vDr43FJaM1w98aFpCYxJKqQppBKitRfPky HXTG55G4SjTbmJZRW6o/jMri57D5IDFZqKNtluknwLJrwq9Gsb+vv/nEN3zkmAMpIkuj CGjEkpwmrDOOQyFhgyYv9SGBWPxm2d5rY1rKFzsPx+ZfX2ZFB9Ngvth7nrg9AlEARELc VnEkRQ9LWnODSToivLC9ZRibCqXZuWwEXb1cIoPjYgBvGk8j82sxFIUc/Agm1JbMqZ05 LE8jtMyZribHhkJpiSh9TfZ3FhoWoqJ1z5A2VnTeA7fbWvFppiu6eNXKNTAe1jYfrrf1 qicQ== X-Gm-Message-State: AOAM5324UXWVeCS7FA281X1jcC64ou6U+iJW/rwFG3v5tS8p15Z0qqib S8kkaj359M8l8f/xOqe8uMavEQ== X-Google-Smtp-Source: ABdhPJzaaGCI5XDdhbfiir22/gITIG7LecOI6azT7UoNaQsRuiPruKgVNUQ+Z9vp6W83/8F3Uwraog== X-Received: by 2002:adf:9b9e:: with SMTP id d30mr4007872wrc.345.1591269062192; Thu, 04 Jun 2020 04:11:02 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:1f68:7ff5:120d:64e]) by smtp.gmail.com with ESMTPSA id b201sm6900387wmb.36.2020.06.04.04.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 04:11:01 -0700 (PDT) In-Reply-To: <87d06f5m2c.fsf@gmail.com> (Pip Cet's message of "Thu, 04 Jun 2020 07:26:03 +0000") Received-SPF: none client-ip=2a00:1450:4864:20::430; envelope-from=contovob@tcd.ie; helo=mail-wr1-x430.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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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:251849 Archived-At: Pip Cet writes: > Paul Eggert writes: > >> On second thought, I'll work on coming up with a better workaround for the >> problem along the lines I suggested in my previous message: >> make-text-button can >> copy the button label string only if the string's not mutable. I hope >> this helps >> with SLY (as I hope SLY is not trying to modify string literals...). > > It is. I'm not sure the copy-sequence-unless-mutable semantics really > make sense, though, as that might make bugs such as this one even harder > to find. > > I think we should add a new function with clean semantics, and throw an > error in the old function if the string isn't "mutable", whatever that > means in this context. (I guess I can't modify the string contents or > add text properties, but can I modify existing properties? What about > cons cells deep within the properties? If they're recursively immutable, > what about markers and other objects that change state behind your > back?) How would make-text-button detect whether its first argument is mutable? Would it not suffice to clarify in its documentation that it modifies its argument, in the same way that we warn about passing immutable lists to nconc? -- Basil