unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Simen Heggestøyl" <simenheg@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 21798@debbugs.gnu.org
Subject: bug#21798: 25.0.50; [PATCH] Add support for retrieving paths to JSON elements
Date: Fri, 06 Nov 2015 17:31:28 +0100	[thread overview]
Message-ID: <1446827488.11140.2@smtp.gmail.com> (raw)
In-Reply-To: <56381558.7050607@yandex.ru>

[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]

Hello Dmitry, thanks for the feedback.

On Tue, Nov 3, 2015 at 3:00 AM, Dmitry Gutov <dgutov@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

[-- Attachment #2: Type: text/html, Size: 2145 bytes --]

  reply	other threads:[~2015-11-06 16:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-31  8:46 bug#21798: 25.0.50; [PATCH] Add support for retrieving paths to JSON elements Simen Heggestøyl
2015-10-31 14:23 ` Dmitry Gutov
2015-11-01 19:52   ` Simen Heggestøyl
2015-11-01 23:27     ` Simen Heggestøyl
2015-11-03  2:00       ` Dmitry Gutov
2015-11-06 16:31         ` Simen Heggestøyl [this message]
2015-11-06 17:15           ` Dmitry Gutov
2015-11-07 13:23             ` Richard Stallman
2015-11-07 13:43               ` Dmitry Gutov
2015-11-07 18:50             ` Simen Heggestøyl
2015-11-07 19:18               ` Dmitry Gutov
2015-11-08 12:32                 ` Simen Heggestøyl
2015-11-08 12:34                   ` Simen Heggestøyl
2015-11-08 16:16                   ` Dmitry Gutov
2015-11-08 21:12                     ` Simen Heggestøyl
2015-11-09  0:20                       ` Dmitry Gutov

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=1446827488.11140.2@smtp.gmail.com \
    --to=simenheg@gmail.com \
    --cc=21798@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).