Subject: Re: bug#49660: 28.0.50; json-available-p should exist

From: Eli Zaretskii <[email-masked]>
Date: Tue, 20 Jul 2021 19:53:55 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked]
> Date: Tue, 20 Jul 2021 17:50:17 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > If you are ready to define json-available-p somewhere other than
> > json.c, then you could simply do that in subr.el or somesuch.  It
> > would be cleaner than defining stubs in loadup.el.
> 
> The meats of json-available-p have to be in json.c, though?

No, it doesn't have to.  You could have json-available-p that simply
tested one of json.c primitives to be fboundp, and if so, tried to
invoke one of them on a trivial input to see if it signals an error.

Alternatively, we could do this like decompress.c does: it would
require the test for availability to be slightly more complex:

  (and (fboundp 'json-available-p)
       (json-available-p))

Would that be good enough?