[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to test for native JSON support?
From: |
Joost Kremers |
Subject: |
Re: How to test for native JSON support? |
Date: |
Tue, 04 May 2021 14:29:53 +0200 |
User-agent: |
mu4e 1.5.12; emacs 27.2 |
On Tue, May 04 2021, Eli Zaretskii wrote:
>> From: Tim Landscheidt <tim@tim-landscheidt.de>
>> Date: Tue, 04 May 2021 11:40:41 +0000
>>
>> Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com> wrote:
>>
>> > json-serialize would return nil if libjansson library is not
>> > available during the execution time. So the scenario would
>> > be someone building Emacs with json support, then forgetting
>> > to put libjansson on his path and/or moving the binary to
>> > another machine. Not very likely to happen on any POSIX
>> > systems, but a more or less tangible case on Windows.
>>
>> That's a rather unexpected, at least undocumented failure
>> mode (vulgo: a bug). IMNSHO in that case json-serialize
>> should either "work" or throw an error.
>
> 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`
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.)
And is there a reason why the native json-functions do not gracefully degrade to
their counterparts in the `json.el` library? That seems like the logical thing
to do and would render testing for native JSON support unnecessary, but perhaps
there's a reason for not doing it.
--
Joost Kremers
Life has its moments
- How to test for native JSON support?, Joost Kremers, 2021/05/02
- Re: How to test for native JSON support?, Nikolay Kudryavtsev, 2021/05/02
- Re: How to test for native JSON support?, Dmitry Gutov, 2021/05/03
- Re: How to test for native JSON support?, Nikolay Kudryavtsev, 2021/05/03
- Re: How to test for native JSON support?, Dmitry Gutov, 2021/05/03
- Re: How to test for native JSON support?, Tim Landscheidt, 2021/05/04
- Re: How to test for native JSON support?, Eli Zaretskii, 2021/05/04
- Re: How to test for native JSON support?,
Joost Kremers <=
- Re: How to test for native JSON support?, Eli Zaretskii, 2021/05/04
- Re: How to test for native JSON support?, Joost Kremers, 2021/05/04
- Re: How to test for native JSON support?, Dmitry Gutov, 2021/05/04
- Re: How to test for native JSON support?, Eli Zaretskii, 2021/05/04
- Re: How to test for native JSON support?, Dmitry Gutov, 2021/05/04
- Re: How to test for native JSON support?, Philipp Stephani, 2021/05/04
- Re: How to test for native JSON support?, Dmitry Gutov, 2021/05/04
- Re: How to test for native JSON support?, Eli Zaretskii, 2021/05/04