GNU bug report logs -
#66554
[PATCH] Add the public API of Compat to the core
Previous Next
Reported by: Philip Kaludercic <philipk <at> posteo.net>
Date: Sun, 15 Oct 2023 09:37:01 UTC
Severity: wishlist
Tags: patch
Done: Philip Kaludercic <philipk <at> posteo.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Stefan Kangas <stefankangas <at> gmail.com> writes:
> Daniel Mendler <mail <at> 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
This bug report was last modified 1 year and 160 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.