From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled. Date: Thu, 10 Aug 2023 10:28:55 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22449"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65051@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 10 16:30:24 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 1qU6gB-0005eh-HR for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Aug 2023 16:30:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qU6fv-00051J-JZ; Thu, 10 Aug 2023 10:30:07 -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 1qU6fs-0004yR-6K for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 10:30:04 -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 1qU6fr-0006z4-UV for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 10:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qU6fq-0006O2-Lm for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 10:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Aug 2023 14:30: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.169167775624462 (code B ref 65051); Thu, 10 Aug 2023 14:30:02 +0000 Original-Received: (at 65051) by debbugs.gnu.org; 10 Aug 2023 14:29:16 +0000 Original-Received: from localhost ([127.0.0.1]:43810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qU6f6-0006MU-3R for submit@debbugs.gnu.org; Thu, 10 Aug 2023 10:29:16 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:38112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qU6f0-0006MB-SN for 65051@debbugs.gnu.org; Thu, 10 Aug 2023 10:29:14 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 118BF1000AD; Thu, 10 Aug 2023 10:29:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1691677739; bh=ZxPzUopqBShhEv3bAJSOeuozfeRZwFH+Sz+JXQSxVuY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=TaBTvRpVoTdr14sNejINXW7cektktG0FuZ65p88ne2Fqllvy1LdHBvOHVOrJ2M3P1 GMHYhPLtOEJdHRCsgQLabfMZOKlf50WUwV0LB/msOvKm7n7kB6RG8J8Vf2CA0Twty4 k96ltz5mU6UpqOvQIIZ5jrZ+zXjC7VUKEV3yzqnV27rPXYju60jb5RqSqgvpiBg5SE q3qdYtd9tyrtzgqmFK6cL/Qok19wYUCE+QOoQ4q09a9FCRKOWsGegDkZ9O1bJT9P6h y2Hf3PdV0MUdVog8Ahjcp4DggE8xzxUOc0rWw2laMAIDV+uZeS4jo0jlFTJt6xSGZu WIDMAodUaEIgw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7CC6510006B; Thu, 10 Aug 2023 10:28:59 -0400 (EDT) Original-Received: from alfajor (unknown [190.190.107.145]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A5446120203; Thu, 10 Aug 2023 10:28:58 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Thu, 10 Aug 2023 09:14:33 +0000") 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:267139 Archived-At: >> IOW affecting the behavior of `equal` is *not* part of "the point of >> s-w-p-e". > Which is precisely why I want to correct the behaviour of equal with > SWPs. I can't see the connection between the two. >> > In the code at the moment, the result of `equal' on symbols with >> > position is undefined, i.e. it returns a random value. >> In which sense? > In the sense it wasn't deliberately coded. It's just a random value > resulting from the code for other scenarios. Then it's not "random" nor "undefined". I'd describe it as "arbitrary". >> AFAICT it returns non-nil iff the underlying bare symbols are `eq`. >> That does not sound "random" at all to me. >> What am I missing? > That equal is different from eq. Then let me rephrase the above: AFAICT it returns non-nil iff the underlying bare symbols are `equal`. See? No` eq` any more :-) > The definition of eq (more or less) is "identical objects". > The definition of equal (more or less) is "same structure with same > components". Yes, but the "more or less" is very applicable to SWP. E.g. one could argue that if two objects are sometimes `eq`, then I think it's a good enough justification to treat them as always `equal`. > See my previous paragraph of this post. You're proposing that the > position elements of SWPs should be ignored in equal. I don't see any > good reason for this. One reason is that it's the semantics we use 99% of the time (where `symbols-with-pos-enabled` is also non-nil). But as I said at the beginning, my main point is that the current behavior is not a *bug*. It's just an arbitrary semantics, and you're proposing to use another arbitrary semantics. And the new arbitrary semantics does not seem clearly superior. IOW, bikeshedding material. >> > It's a special case when no special case is needed. >> Making `equal` depend on a global variable is also introducing >> a special case. > I know you don't like symbols-with-pos-enabled, but it's there. > It implements, by its very nature, special cases when it's non-nil. > You want to extend those special cases to the behaviour when it's nil. I'd say it's a biased way to look at it. For `eq` the semantics provided by `symbols-with-pos-enabled` is definitely very special because it is fundamentally incompatible with the usual promise of `eq` which is that when two objects are `eq` you can't distinguish them at all. But the behavior for `equal` is not "special" IMO. It fits within the general behavior of `equal`. > The consistency of Emacs's basic functions seems very important to me, > and it's likely very important to other people, too. You seem to be > dismissing it as unimportant. No, I don't dismiss the importance of consistency in general. I just think here both behaviors are about equally consistent with the general behavior of `equal`. So consistency is not a good guideline because it's based on nothing more than opinions. > I've outlined several times why it's a bug. That has not come through, I'm afraid. All I've seen so far are repetitions that you think the current behavior is inconsistent/undefined/random. None of it is concrete, and I disagree with them, so it's just my opinion against your opinion. We're not going to have much success with that. Hence the need for more concrete practical arguments. >> > It was me that coded up that amendment to equal, and I can remember >> > simply not taking into account the scenario we're talking about. >> Which scenario? > Comparing two arguments using equal, at least one of which is a > symbol with position, when symbols-with-pos-enabled is nil. Ah, sorry, I thought you were referring to a more concrete use-case where such a `equal` test would occur. Having such use-cases would help the current discussion significantly, since currently we're basically arguing about what Emacs should do in cases that never occur. >> We don't know, admittedly, but we do know that if/when it has happened, >> it hasn't caused any problem so far. > Just like binding symbols-with-position-enabled in > internal-macroexpand-for-load didn't cause any problems, until it did > (bug #65017). We don't know that. Maybe the new behavior would be the one that introduces such bugs. Or maybe both. Or neither. We just have no idea. > So why are you making such a big thing out of it? [ Hmm... I have a feeling of d=E9j=E0-vu. ] > I see quite clearly which of these options is correct. > Why won't you respect my superior insight into the matter? [ Hmm... this sounds a bit arrogant, so I'll just skip it. ] >> It makes it impure, and will invalidate existing optimizations, >> exactly like we've just witnessed for `eq`. > Which optimisations are you talking about here? Just how is equal > optimised? The same one that causes my bug-fix to fail: (let ((symbols-with-position-enabled V)) (equal E1 E2)) is optimized to (equal E1 E2) -- Stefan