From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How to test for native JSON support?
Date: Tue, 04 May 2021 15:50:23 +0300 [thread overview]
Message-ID: <834kfi64ts.fsf@gnu.org> (raw)
In-Reply-To: <87fsz2n075.fsf@fastmail.fm> (message from Joost Kremers on Tue, 04 May 2021 14:29:53 +0200)
> From: Joost Kremers <joostkremers@fastmail.fm>
> Cc: help-gnu-emacs@gnu.org
> Date: Tue, 04 May 2021 14:29:53 +0200
>
> > It actually displays an error message, in addition to returning nil
> > (as do all other JSON primitives in that case).
>
> So should I wrap my call to `(json-serialize '((test . 1)))` in `ignore-errors`
It doesn't signal an error, just displays a message. So it
effectively already does ignore-errors.
> if I don't want to worry unsuspecting users with a (possibly to them arcane)
> error message? (Unfortunately, I don't have access to a Windows machine so I
> can't test this myself.)
The message is "jansson library not found".
But to answer your question, you should allow the user to determine
whether the built-in or the Lisp implementation will be used, because
only the user knows whether the library is installed.
> And is there a reason why the native json-functions do not gracefully degrade to
> their counterparts in the `json.el` library?
First, because no one wrote the code to do that; patches welcome.
Second, because the implementations are not 100% equivalent, neither
in the API names nor in some aspects of the functionality. So
automatic replacement is not trivial, not in general anyway.
next prev parent reply other threads:[~2021-05-04 12:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-02 12:09 How to test for native JSON support? Joost Kremers
2021-05-03 0:20 ` Nikolay Kudryavtsev
2021-05-03 8:21 ` Joost Kremers
2021-05-03 14:38 ` Nikolay Kudryavtsev
2021-05-03 18:59 ` Joost Kremers
2021-05-03 19:42 ` Dmitry Gutov
2021-05-03 22:33 ` Nikolay Kudryavtsev
2021-05-03 22:39 ` Dmitry Gutov
2021-05-04 11:40 ` Tim Landscheidt
2021-05-04 12:16 ` Eli Zaretskii
2021-05-04 12:29 ` Joost Kremers
2021-05-04 12:50 ` Eli Zaretskii [this message]
2021-05-04 13:06 ` Joost Kremers
2021-05-04 13:17 ` Dmitry Gutov
2021-05-04 14:01 ` Eli Zaretskii
2021-05-04 14:30 ` Dmitry Gutov
2021-05-04 14:32 ` Philipp Stephani
2021-05-04 14:41 ` Dmitry Gutov
2021-05-04 15:16 ` 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=834kfi64ts.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@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.
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).