Subject: bug#65017: 29.1; Byte compiler interaction with cl-lib function objects, removes symbol-function

From: Alan Mackenzie <[email-masked]>
Date: Fri, 4 Aug 2023 09:55:46 +0000

Hello, Stefan.

On Thu, Aug 03, 2023 at 17:46:44 -0400, Stefan Monnier wrote:
> > Sorry about my last post.  I now see what the core problem is, namely
> > that (equal 'equal #<symbol equal at 49>) is returning non-nil.

> This is not really the core problem IIUC since `cl-macs.el` uses `eq`
> rather than `equal` so changing `equal` won't make much of
> a difference here.

No, it wasn't the cause of this bug.  It's a separate bug in its own
right, though.

> I'm not sure whether the above should return nil, or non-nil, or the value
> of `symbols-with-pos-enabled`, to be honest, but I guess returning non-nil
> has worked fine until now, so I think we'd be better off staying with that.

I've lost the context, somewhat, but the key thing is that the notion of
symbol with position isn't really defined when symbols-with-pos-enabled
is nil.  Returning non-nil for (equal 'foo #<symbol foo at 42>) in this
case is like saying 'foo is equal to an undefined entity.  This is
asking for the sort of trouble we're seeing in this bug.

> I'd even like it to try and replace uses of `eq/eql` with `equal` in
> those cases where we want to overlook differences in symbol-positions, so
> that we can eventually get rid of `symbols-with-pos-enabled` which
> I consider as a wart.

OK.  I don't think you can do this, because you'd have to replace lots
of eq's in macros with equal.  We don't control all these macros.
That's aside from the massive disruption this would cause to bytecomp.el
and friends.  I don't think you should do this, since
symbols-with-pos-enabled, ugly though it may be, is working.  Also,
you'd have to be careful not to slow Emacs down.

Now, let's diagnose bug#65017!

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).