Hello Dmitry, thanks for the feedback. On Tue, Nov 3, 2015 at 3:00 AM, Dmitry Gutov 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