[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiled code in Emacs-26 will fail in Emacs-25 if use pcase [was: A
From: |
Stefan Monnier |
Subject: |
Re: Compiled code in Emacs-26 will fail in Emacs-25 if use pcase [was: Add new bytecode op `switch' for implementing branch tables.] |
Date: |
Sat, 02 Jul 2022 17:28:55 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> I'm with you on your thoughts about removing the need for users to often
> have to deal with byte-code or native-code compilation differences when
> running different major versions of Emacs. But it is now 2022 and the
> situation seems to be much worse than it was five years ago.
What makes you think it is worse?
> Say you use Emacs 27, 28 and 29,
5 years ago, that would have been ... 25, 26, and 27, right?
> some with native compilation and some not.
AFAIK native compilation is fully transparent, so it shouldn't make
cause any extra trouble for the end-user (except maybe when it doesn't
work, but that's a separate issue).
> But you want to keep the same set of packages in use across all
> these installations.
The rule is that you need to compile with the oldest Emacs you're
still using. Can you think of a package that can be compiled with
Emacs-27 but whose resulting .elc files won't work in Emacs-29?
AFAIK the only problem with a situation like the one you describe
is when the user install a package with Emacs-NN and then tries to use
this package with Emacs-MM where MM < NN.
Ideally, we should detect this situation and force a recompilation of
the package (the result of which should still work fine on Emacs-NN).
The .elc files already contain the needed info: they start with
";ELC<NN>" where <NN> is a char that represents the major version of
Emacs that compiled this file (char code 28 for both Emacs-28.1 and
Emacs-28.2).
So it's a "small matter" of adding code to detect when we load a file
that's been compiled by a "future Emacs" and then cause it to be recompiled.
Stefan