Subject: Re: bug#54079: 29.0.50; Method dispatching eratically fails

From: Alan Mackenzie <[email-masked]>
Date: Sat, 5 Mar 2022 19:00:49 +0000

Hello, Stefan.

On Sat, Mar 05, 2022 at 12:57:09 -0500, Stefan Monnier wrote:
> > I think this problem can only happen for defuns/defvars/defconts inside
> > eval-when-compile or eval-and-compile.
> > Would you try out the following patch, please, which I believe fixes the
> > bug.

> Any chance we could fix it in `bytecomp.el` by calling
> `byte_run_strip_symbol_positions` before evaluating the contents of
> those forms?

I've spent quite a large part of the day trying to get that to work,
without success.  The point is, we want to strip the positions here only
when we're writing the value to a defun/defvar/defconst.
eval-when/and-compile doesn't know what its forms will be doing, and
there's no easy way to find out - for example, there might be a defun in
a nested eval-when/and-compile.  Checking in the defun/defvar/defconst
special forms is direct and economical.

> Maybe we should have a function to check for the absence of
> sympos which we could call (when in debugging mode only) from
> defvar/defalias and friends, which could give us useful backtraces
> showing where/when the sympos "leak"?

That's an interesting idea.  Such a function would differ from
byte-run-strip-symbol-positions only a little bit.

>         Stefan

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).