From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 60311@debbugs.gnu.org
Subject: bug#60311: json-available-p: make dynamically correct for Windows
Date: Mon, 26 Dec 2022 13:11:21 +0100 [thread overview]
Message-ID: <87FCD796-629F-44AE-B539-2DDAE6C148F2@gmail.com> (raw)
In-Reply-To: <83wn6f330g.fsf@gnu.org>
25 dec. 2022 kl. 16.40 skrev Eli Zaretskii <eliz@gnu.org>:
> Yes, you are right. But please come up with a smaller changeset which
> only changes what strictly needs to be changed. Or if you want, I can
> do this myself.
Since you have very specific ideas about how to go about it it's better that you make the change yourself. After all, attempts to remote-control someone else this way rarely make either party very happy.
As long as it gets done I'm not very particular about it myself.
>> + (and (eval-when-compile (fboundp 'json-serialize))
>> + ;; If `json--available-p' is present, we need to call it at run-time.
>> + (or (not (eval-when-compile (fboundp 'json--available-p)))
>> + (json--available-p))))
>
> Btw, I don't understand this use of eval-when-compile here. Can you
> explain why should we care at compile time whether these functions are
> fboundp?
Because we can: we already know the answers when subr.el is compiled, giving us constant nil or t values that will simplify the function to a constant or a call to json--available-p.
> why not just
>
> (and (fboundp 'json--available-p)
> (json--available-p))
Calling `fboundp` at run time is wasteful, and that patch used the presence of json--available-p to indicate whether it needs to be called at run time (on Windows only, but it's good to keep that platform-dependency in one place).
It doesn't matter much if json-available-p is implemented in Lisp or C; even performance-wise it's a wash.
next prev parent reply other threads:[~2022-12-26 12:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-25 14:32 bug#60311: json-available-p: make dynamically correct for Windows Mattias Engdegård
2022-12-25 15:34 ` Mattias Engdegård
2022-12-25 15:40 ` Eli Zaretskii
2022-12-25 16:24 ` Eli Zaretskii
2022-12-25 17:26 ` Eli Zaretskii
2022-12-26 12:11 ` Mattias Engdegård [this message]
2022-12-26 13:29 ` Eli Zaretskii
2022-12-25 18:43 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87FCD796-629F-44AE-B539-2DDAE6C148F2@gmail.com \
--to=mattias.engdegard@gmail.com \
--cc=60311@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).