From: "João Távora" <joaotavora@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Support custom 'null' and 'false' objects when parsing JSON
Date: Fri, 08 Jun 2018 00:08:28 +0100 [thread overview]
Message-ID: <87muw6i49f.fsf@gmail.com> (raw)
In-Reply-To: <jwvpo12fmh4.fsf-monnier+gmane.emacs.devel@gnu.org> (Stefan Monnier's message of "Thu, 07 Jun 2018 15:13:17 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> the keyword :null, I have to explicitly check for non-`nil'ness *and*
>> non-`:null'ness, whereas before only one check was necessary. Other
>
> IIUC this is a matter of changing things like
>
> (null x)
> to
> (memq x '(nil :null))
>
> right? On this one example it doesn't look that bad
More like from
x
to
(not (memq x '(nil :null)))
or to
(and (not (memq x '(nil :null))) x)
if you're planning on destructuring x
Not exactly pretty. Sure, I could change `when's to `unless`es, or wrap
that in a macro, but still akward.
Also, I don't see why we shouldn't work towards some (or total) json.el
compatibility, presuming it's easy and cheap like in this case here.
>> -json_to_lisp (json_t *json, enum json_object_type object_type)
>> +json_to_lisp (json_t *json,
>> + enum json_object_type object_type,
>> + Lisp_Object null_object,
>> + Lisp_Object false_object)
>
> Wouldn't it make sense to group those 3 parameters into a single object
> (presumably a pointer to a stack-allocated struct containing those
> 3 fields)?
Yes it would, good idea.
João
next prev parent reply other threads:[~2018-06-07 23:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 18:29 [PATCH] Support custom 'null' and 'false' objects when parsing JSON João Távora
2018-06-07 19:13 ` Stefan Monnier
2018-06-07 23:08 ` João Távora [this message]
2018-06-08 1:45 ` João Távora
2018-06-09 8:18 ` Eli Zaretskii
2018-06-09 14:49 ` João Távora
2018-06-09 15:18 ` Eli Zaretskii
2018-06-14 23:23 ` João Távora
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=87muw6i49f.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).