From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled. Date: Fri, 11 Aug 2023 21:15:12 +0300 Message-ID: <8640914d-1f58-300c-da86-2ca6e214a513@gutov.dev> References: <6a81c696-4e6a-ac24-6c66-7e2b541ed67a@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29126"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: 65051@debbugs.gnu.org, Stefan Monnier To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 11 20:16:13 2023 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 1qUWgG-0007LQ-L7 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Aug 2023 20:16:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUWg8-0000bS-OU; Fri, 11 Aug 2023 14:16:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUWg7-0000b3-6X for bug-gnu-emacs@gnu.org; Fri, 11 Aug 2023 14:16:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qUWg6-0002Sm-V0 for bug-gnu-emacs@gnu.org; Fri, 11 Aug 2023 14:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qUWg6-0006uX-Hj for bug-gnu-emacs@gnu.org; Fri, 11 Aug 2023 14:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Aug 2023 18:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65051 X-GNU-PR-Package: emacs Original-Received: via spool by 65051-submit@debbugs.gnu.org id=B65051.169177772426513 (code B ref 65051); Fri, 11 Aug 2023 18:16:02 +0000 Original-Received: (at 65051) by debbugs.gnu.org; 11 Aug 2023 18:15:24 +0000 Original-Received: from localhost ([127.0.0.1]:47943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUWfU-0006tZ-4R for submit@debbugs.gnu.org; Fri, 11 Aug 2023 14:15:24 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUWfR-0006tK-NL for 65051@debbugs.gnu.org; Fri, 11 Aug 2023 14:15:22 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A65285C0088; Fri, 11 Aug 2023 14:15:15 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 11 Aug 2023 14:15:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1691777715; x=1691864115; bh=jBojgsLSQSvpBiKHx9TY369zES6gPWOvY2w 80oMLnME=; b=li3ksVEEobvoeRy6PiyxtadnJwsyd2invg+pARSJvEjb6e5bc9T NAYd1q4Ev19uvqN81SQYiPyoaBE7GzkOpxb/rrAmcT8uWlzF2Ox1cFeyxZX5KaRr h9DKww0XpnrKze1arDyW55Vkg6t9Xv9PHyIaXcviFvRtUGYFT7UVI7cPibClokVC JTnkQeEew8GkYx2f2CMm3mNjb1LQ6NTgInMcevjZwiJT1HUa4yqta2YeC7Vnr/li MPQFKPZDLLAQjfDfdY7tsAP3eTAnSaZbbUpfQDg7soU9+LOBMgAiefDzcQ2bg/mY y9t4o6Qx+HtShWA9+p47I/tnKb6HEpqFyTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1691777715; x=1691864115; bh=jBojgsLSQSvpBiKHx9TY369zES6gPWOvY2w 80oMLnME=; b=nXuGx4KWiZhkNJQttje8VSn28Spv48MSYiKmX98D61yxisBMRqh txOSZII6smJPerdI4YIwDmH/TU7WApZzetqBkKyeKaBhnU5F7HyNbDwmZD4iLjKP gYtsBUvQFqYZqWD1+mrUF9h5MoYVeVJ7qLl9mh0EhCRVvylu7zBrCUBL7HgdR6c9 Q4zezIkGW/JKISSjp4sOyUbWY2zb86x5FtdmU0n9jAf2KP7GkRT5iOQtydzQjs9T 3AfYn8115u9br05RmYNL06Xul+mspzSeenvf9PLg91XC94WVMx8BtDGRv1SsInC4 Qk1STFyQD5GLHKNznPAX0S0SJbRkCqhBoPA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrleekgdduvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 11 Aug 2023 14:15:14 -0400 (EDT) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267226 Archived-At: Hi Alan, On 11/08/2023 17:04, Alan Mackenzie wrote: >> > Currently, the working of s-w-p-enabled is inconsistent, and >> > should be fixed, which is what this bug is about. > >> Inconsistent with what? > > With its definition: when s-w-p-enabled is non-nil, SWPs are handled > specially. When it's nil, they're not (or, at least, shouldn't be). Point taken. So either the behavior needs to be changed, or the docstring updated. >> If we're talking about the relation between EQUAL and EQ, objects that >> are EQ have to be EQUAL, but those that are EQUAL don't have to be EQ. > > I wasn't talking about that relationship, no, but there is no danger to > it in fixing the current bug (or, indeed, in leaving it unfixed). Yep. >> Anyway, I'd like to offer a question from a different perspective: >> should two symbols-with-positions where the positions are different but >> the symbol is the same, be equal between each other? > > Yes, when and only when symbols-with-pos-enabled is non-nil. > >> If yes (which is my reading of fns.c:2755), then it makes sense for >> them to be equal-able to symbols without positions as well. > > Again, this should be the case when s-w-p-enabled is non-nil and only > then. All right, that also makes sense. And I can see some theoretical benefit to not having these kinds of objects be 'equal' in contexts where that is not anticipated in advance (and so the variable is not bound). Especially in a stronger-typed language where such comparison or pattern matching could result in an error (e.g. comparing incompatible types). In our case, since we're just talking about 'equal', the comparison could result in execution just falling though and e.g. some bytecomp optimization not being applied, silently (hence the talk of "if not broken don't fix it"). It would be nice to see a piece of code that would benefit from the distinction. The reverse example I can imagine myself (some pcase form outside of any such binding, whether by accident or not).