Subject: Re: bug#66554: [PATCH] Add the public API of Compat to the core

From: Daniel Mendler <[email-masked]>
Date: Thu, 18 Jan 2024 21:41:01 +0100

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

>> +;;;; Hack to avoid installing Compat if not necessary
>> +
>> +;; The versioning scheme of the Compat package follows that of Emacs,
>> +;; to indicate what version of Emacs is being supported.  For example,
>> +;; the Compat version number 29.2.3.9 would attempt to provide
>> +;; compatibility definitions up to Emacs 29.2, while also designating
>> +;; that this is the third major release and ninth minor release of
>> +;; Compat, for the specific Emacs release.
>> +
>> +;; To ensure that if the user is using Emacs X.Y installed, the ELPA
>> +;; package Compat X.Y.Z* (for any values of Z*) does not get
>> +;; unnecessarily installed, as there are no missing features that
>> +;; Compat could provide, we programmatically specify the version of
>> +;; the package to be that of the current Emacs version plus a high
>> +;; "major release" to exceed the major version of Compat.
>> +
>> +;;;###autoload (push (list 'compat emacs-major-version emacs-minor-version most-positive-fixnum) package--builtin-versions)
>
> Hack?  Why call it a hack?
>
> By definition a `compat-NN.MM` package is attempting to provide a subset
> of the API offered by Emacs-NN.MM, so Emacs-NN.MM very much provides
> a version of `compat-NN.MM`.
> IOW
>
>     (push (list 'compat emacs-major-version emacs-minor-version ...)
>           package--builtin-versions)
>
> is not a hack at all.

Yes, the specified version is not a hack, since it correctly encodes the
API version provided by the compat.el in core.

> If you want to label the `most-positive-fixnum` as a hack, I guess
> that's OK but then the comment should clarify what it's referring to.

I may be wrong, but I assume that Philip considers the autoload a hack.
In this thread we discussed various alternatives to approach this
problem, e.g., the package version regexp (another hack), or my naive
idea of simply writing 29.1.9999 in the compat.el package header (yet
another hack).

Daniel