all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: mattias.engdegard@gmail.com, 65017@debbugs.gnu.org,
	monnier@iro.umontreal.ca, eric.marsden@risk-engineering.org
Subject: bug#65017: 29.1; Byte compiler interaction with cl-lib function objects, removes symbol-function
Date: Fri, 4 Aug 2023 16:43:12 +0000	[thread overview]
Message-ID: <ZM0qoHYWDxEe-Lt9@ACM> (raw)
In-Reply-To: <83jzuavnm2.fsf@gnu.org>

Hello, Eli.

On Fri, Aug 04, 2023 at 18:22:29 +0300, Eli Zaretskii wrote:
> > Date: Fri, 4 Aug 2023 14:49:56 +0000
> > Cc: monnier@iro.umontreal.ca, mattias.engdegard@gmail.com,
> >   65017@debbugs.gnu.org, eric.marsden@risk-engineering.org
> > From: Alan Mackenzie <acm@muc.de>

> > > > symbols-with-pos-enabled gets erroneously
> > > > bound to t in internal-macroexpand-for-load (emacs-lisp/macroexp.el).
> > > > This is the cause of the bug; in cl--labels-convert it causes the first
> > > > eq to return non-nil when comparing 'equal to #<symbol equal at 194>.

> > > Why "erroneously"? what are the rules for binding that variable to a
> > > non-nil value?

> > internal-macroexpand-for-load isn't being called in the context of a
> > byte compilation.  It might create a symbol with position which wrongly
> > matches, or fails to match, another symbol.  This is what has happened
> > in this bug.

> If internal-macroexpand-for-load is "verboten" from being called by
> the byte-compiler, I'd expect an assertion in it to that effect.
> Because someone, some day, might easily forget and call that function
> in the byte-compiler.

I don't think there's any such prohibition in this case.  The function is
called only from readevalloop in src/lread.c as part of loading a .el
file.  It is probable that an eval-when-compile could cause a .el file to
be loaded during a byte compilation.  This would call
internal-macroexpand-for-load with symbols-with-pos-enabled non-nil, I
think.

> Btw, why was this binding added there to begin with?

A good question.  It was back in January 2022, I was getting eager macro
expansion failures while trying to bootstrap (my development version of)
Emacs.  Binding that variable made those failures go away.  It turns out,
that was not the correct fix.  Somehow that erroneous binding stayed in
the code and got committed.

> > > I don't see any of that documented in the "Symbols with Position" node
> > > of the ELisp manual.

> > Well, there is the sentence: "These objects are intended for use by the
> > byte compiler, which records in them the position of each symbol
> > occurrence and uses those positions in warning and error messages.".

> > Do you think this should be firmed up to something like:  "These objects
> > are for the use of the byte compiler, which records in them the position
> > of each symbol occurrence and uses those positions in warning and error
> > messages.  They shouldn't normally be used otherwise."?

> Something like that, perhaps even stronger.  And maybe an explanation
> what kind of problems could using them outside of the byte compiler
> cause.

OK.  Maybe ".... They shouldn't normally be used otherwise.  Doing so can
cause unexpected results with basic Emacs functions such as `eq' and
`equal'."?

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2023-08-04 16:43 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 10:28 bug#65017: 29.1; Byte compiler interaction with cl-lib function objects, removes symbol-function Eric Marsden
2023-08-03  9:39 ` Mattias Engdegård
2023-08-03 14:43   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-03 15:37     ` Mattias Engdegård
2023-08-03 16:36       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-03 16:53         ` Mattias Engdegård
2023-08-03 17:30           ` Mattias Engdegård
2023-08-03 16:43     ` Alan Mackenzie
2023-08-03 17:30       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-03 18:22         ` Alan Mackenzie
2023-08-03 21:00           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-03 21:10         ` Alan Mackenzie
2023-08-03 21:46           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-04  9:55             ` Alan Mackenzie
2023-08-05 22:45               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-04 10:14             ` Mattias Engdegård
2023-08-04 11:11               ` Alan Mackenzie
2023-08-04 13:41                 ` Mattias Engdegård
2023-08-05 22:40               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-06 10:47                 ` Mattias Engdegård
2023-08-08  2:33                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-04  5:35           ` Eli Zaretskii
2023-08-04 14:16             ` Alan Mackenzie
2023-08-05 20:22             ` Alan Mackenzie
2023-08-06  4:49               ` Eli Zaretskii
2023-08-04 13:22     ` Alan Mackenzie
2023-08-04 14:04       ` Eli Zaretskii
2023-08-04 14:49         ` Alan Mackenzie
2023-08-04 15:22           ` Eli Zaretskii
2023-08-04 16:43             ` Alan Mackenzie [this message]
2023-08-04 17:54               ` Eli Zaretskii
2023-08-05 22:58             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-05 22:53       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-06 11:59         ` Alan Mackenzie
2023-08-08  2:44           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-08 16:56             ` Alan Mackenzie
2023-08-10  3:41               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-10 14:50                 ` Alan Mackenzie
2023-08-12  3:28                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-12  9:59                     ` Mattias Engdegård
2023-08-12 18:21                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-12 10:40                     ` Mattias Engdegård
2023-08-12 16:46                     ` Alan Mackenzie
2023-08-12 18:28                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-13 10:10                         ` Alan Mackenzie
2023-08-13 16:12                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-14 17:10                             ` Alan Mackenzie
2023-08-03 16:11   ` Alan Mackenzie
2023-08-03 16:41     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-03 18:48       ` Alan Mackenzie
2023-08-09 12:27 ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZM0qoHYWDxEe-Lt9@ACM \
    --to=acm@muc.de \
    --cc=65017@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=eric.marsden@risk-engineering.org \
    --cc=mattias.engdegard@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.