GNU bug report logs -
#21798
25.0.50; [PATCH] Add support for retrieving paths to JSON elements
Previous Next
Reported by: Simen Heggestøyl <simenheg <at> gmail.com>
Date: Sat, 31 Oct 2015 08:47:01 UTC
Severity: wishlist
Tags: patch
Found in version 25.0.50
Done: Simen Heggestøyl <simenheg <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hello Dmitry, thanks for the feedback.
On Tue, Nov 3, 2015 at 3:00 AM, Dmitry Gutov <dgutov <at> yandex.ru> wrote:
> I have to say, I'm still not very comfortable with mixing it sort of
> alien logic inside json-read-object and json-read-array (would anyone
> else like to chime in with their opinion?).
I understand your uneasiness, I feel the same way after you pointed it
out.
> Here's an idea: both json-read-object-1 and json-read-array-2 will
> advise json-read to add the new logic around calls to it (there will
> have to be some guard in the advice, so that recursive calls are run
> unmodified).
I'm reluctant to use advises for it, not based on my own experience, but
based on advice from the Elisp manual:
> [...] advice should be reserved for the cases where you cannot modify
> a function’s behavior in any other way. [...] In particular,
> Emacs’s
> own source files should not put advice on functions in Emacs. (There
> are currently a few exceptions to this convention, but we aim to
> correct them.)
Here we do have a chance to modify the functions' behavior.
How about a sort of compromise between our approaches: provide
'json-read-object' and 'json-read-array' with pre- and post-read
callback functions, that are only called when they're set. That would
make it possible to leverage the power of 'json-read-object' and
'json-read-array' by binding the callback functions, without mixing
alien logic into them.
That would also make it a lot cleaner when adding other extensions to
them in the future, compared to my original suggestion.
If that sounds good to you, I'll cook up a new patch!
-- Simen
[Message part 2 (text/html, inline)]
This bug report was last modified 9 years and 201 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.