GNU bug report logs - #54079
29.0.50; Method dispatching eratically fails

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Mon, 21 Feb 2022 00:14:02 UTC

Severity: normal

Found in version 29.0.50

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

Bug is archived. No further changes may be made.

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Lars Ingebrigtsen <larsi <at> gnus.org>, 54079 <at> debbugs.gnu.org
Subject: Re: bug#54079: 29.0.50; Method dispatching eratically fails
Date: Tue, 08 Mar 2022 14:53:07 -0500
> diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
> index 9be44a8d5a..fb9f70bd67 100644
> --- a/lisp/emacs-lisp/bytecomp.el
> +++ b/lisp/emacs-lisp/bytecomp.el
> @@ -499,9 +499,10 @@ byte-compile-initial-macro-environment
>                                         (byte-compile-new-defuns
>                                          byte-compile-new-defuns))
>                                     (setf result
> -                                         (byte-compile-eval
> +                                         (byte-run-strip-symbol-positions
> +                                          (byte-compile-eval
>                                             (byte-compile-top-level
> -                                            (byte-compile-preprocess form)))))))
> +                                            (byte-compile-preprocess form))))))))

I'd expect the reverse: strip first and then eval the result.
Why should we not strip the form passed to `byte-compile-eval`?
Does `byte-compile-top-level` already return a stripped form of code?
And why bother stripping the result of `byte-compile-eval`?

> @@ -512,9 +513,10 @@ byte-compile-initial-macro-environment
>                                ;; or byte-compile-file-form.
>                                (let* ((print-symbols-bare t) ; Possibly redundant binding.
>                                       (expanded
> -                                      (macroexpand--all-toplevel
> -                                       form
> -                                       macroexpand-all-environment)))
> +                                      (byte-run-strip-symbol-positions
> +                                       (macroexpand--all-toplevel
> +                                        form
> +                                        macroexpand-all-environment))))
>                                  (eval expanded lexical-binding)
>                                  expanded)))))
>      (with-suppressed-warnings

Fundamentally, `eval` should always strip before doing its job.  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?


        Stefan





This bug report was last modified 3 years and 67 days ago.

Previous Next


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