bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54079: 29.0.50; Method dispatching eratically fails


From: Stefan Monnier
Subject: bug#54079: 29.0.50; Method dispatching eratically fails
Date: Tue, 08 Mar 2022 16:03:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>> I'd expect the reverse: strip first and then eval the result.
>> Why should we not strip the form passed to `byte-compile-eval`?
> It's an edge case either way, but the form being evaluated might be a
> `byte-compile', in which case it's (much) better to leave the positions
> in place during this operation.

I don't understand the scenario you're thinking of.
Are you thinking of something like `(eval-when-compile (byte-compile ...))?
Does that ever happen in real life?

>> Does `byte-compile-top-level` already return a stripped form of code?
> Compiled code is always stripped, at least since the weekend!

OK, so no need to strip, go.

>> And why bother stripping the result of `byte-compile-eval`?
> Because it might be the result of evaluating a defun (or defvar or
> defconst).

AFAIK sympos should only appear within the compiler pipeline between the
"read" and the "emit resulting bytecode".  They may be passed to various
functions and macros along the way, but I can't think of any scenario
where they'd end up returned by `(byte-compile-)eval`.

> This was the situation which gave rise to the bug.

Could you give some details about how it played out?
[ Either here or as a comment in the code.  ]

>> Fundamentally, `eval` should always strip before doing its job.
> Except when what it's evaluating is a defun, defmacrro, defsubst, etc.

Why?

> Then it would be better to evaluate SWPs (which would work, since we're
> inside a compilation, where enable-symbols-with-pos has been bound).
> But here EXPANDED has been stripped before being evaluated, so I'm not
> sure what you're saying here.

I was suggesting to move the strip from the computation of `expanded` to
the `eval` call.

>> Yes, I know, it might be a bit expensive, but we should probably
>> define a local function in `bytecomp.el` which does strip+eval and use
>> that instead of `eval` (both here and in `byte-compile-eval`).  WDYT?
> I don't think stripping is really all that expensive.  There are one or
> two .el files in Emacs (ucs-normalize.el springs to mind) which have
> very large lists with vectors in them, yet they don't seem noticeably to
> slow down the Emacs build.

So maybe we should redefine `eval` as "strip and then eval"?


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]