bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#55278: json-parse-string


From: Daniel Mendler
Subject: bug#55278: json-parse-string
Date: Mon, 9 May 2022 12:39:54 +0200


On 5/9/22 12:27, Lars Ingebrigtsen wrote:
> Richard Stallman <rms@gnu.org> writes:
> 
>> I agree that we should implement some built-in fallback mechanism
>> so that it works for all packages that use json parsing.
> 
> The two libraries aren't really compatible without reparsing the entire
> parse tree returned by them.  For instance, the C library returns:

The json-parse-string implementation in compat.el should be compatible
as far as I understood Philip and it relies on json.el.

> Libraries like osm.el depend on the former type, and it parses a lot of
> data, making compat transformations prohibitively slow.  We'd be doing
> our users a disservice if we were to just be slow here instead of
> telling them the real story: Build your Emacs with jansson support,
> already.  (This happens by default if you have the library installed.)

Yes, that's a good point. Should we rather bail out or try to do our
best by falling back to a slower implementation? For example eww bails
out if libxml is missing, probably rightly so.

In osm-mode I have a list of requirements which must be satisfied before
it can be used reasonably. These requirements are also listed in the
README and in the Commentary of the package.

  (unless (display-graphic-p)
    (warn "osm: Graphical display is required"))
  (dolist (type '(svg jpeg png))
    (unless (image-type-available-p type)
      (warn "osm: Support for %s images is missing" type)))
  (unless (libxml-available-p)
    (warn "osm: libxml is not available"))
  (unless (ignore-errors (equal [] (json-parse-string "[]")))
    (warn "osm: libjansson is not available"))

Daniel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]