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

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

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


From: Daniel Mendler
Subject: bug#66554: [PATCH] Add the public API of Compat to the core
Date: Fri, 19 Jan 2024 07:42:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Kangas <stefankangas@gmail.com> writes:

> Daniel Mendler <mail@daniel-mendler.de> writes:
>
>>> 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).
>
> IMHO, the "naive" (why naive?) number 9999 is more readable, and in
> practice will be the same as using most-positive-fixnum.  So I'd just
> use that.

The number 9999 is of course more than large enough. What I meant here -
not the choice of the number is what one may consider a hack, but the
way we register the version of the builtin compat.el package. There were
multiple ways which have been discussed in this thread:

- Write the package version of compat.el directly in the header. This
  was my first proposal. This is not ideal since it requires the
  maintainer to update the header whenever a new version of Emacs is
  released. Therefore naive.

- Stefan Monnier proposed to instead use an autoload and to dynamically
  "compute" and register the builtin compat.el version. I consider this
  a clever trick. It is maybe a bit unconventional to register builtin
  package versions like this, but it will work perfectly well and
  doesn't require any intervention. There is no risk that one can forget
  to update the package header.

If we register (emacs-major-version emacs-minor-version 9999),
(emacs-major-version emacs-minor-version most-positive-fixnum) or
(emacs-major-version emacs-minor-version 1.0e+INF) will not make any
difference in practice. As long as the number is large enough, it will
work.

We should still keep the reader of the code in mind, who may wonder
about the magic number and about the special package version
registration, so a comment is certainly justified. Philip did include
such an explanation in his patch. We should only replace the word "Hack"
with "Clever trick" in the comment.

Daniel





reply via email to

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