GNU bug report logs - #65051
internal_equal manipulates symbols with position without checking symbols-with-pos-enabled.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Fri, 4 Aug 2023 14:01:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #110 received at 65051 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 65051 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#65051: internal_equal manipulates symbols with position
 without checking symbols-with-pos-enabled.
Date: Fri, 11 Aug 2023 21:15:12 +0300
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).




This bug report was last modified 1 year and 314 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.