From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file
Date: Mon, 03 Mar 2014 10:56:20 -0700 [thread overview]
Message-ID: <5314C244.5070805@redhat.com> (raw)
In-Reply-To: <8738izxpyb.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 2446 bytes --]
On 03/03/2014 08:27 AM, Markus Armbruster wrote:
>>>> +The QAPI schema definitions can be modularized using the 'include'
>>>> directive:
>>>> +
>>>> + include("sub-system/qapi.json")
>>
>>> And now it isn't JSON anymore.
>>
>>> To keep it JSON, use syntax like
>>
>>> { "include": "sub-system/qapi.json" }
I actually think this looks nicer - makes the file more consistent.
>>
>>> If you absolutely must make it non-JSON, you better rename the .json
>>> files.
>>
>>> Hmm, we already are non-JSON, because we use ' instead of " for no sane
>>> reason.
A weak argument: ' is easier than " to type (at least on US keyboards -
no shift key required).
Another weak argument: using ' in the qapi files vs. " in actual QMP
makes it easy to interleave discussions about semantics vs. examples of
those semantics in use (you can see whether a code snippet is talking
about qapi or wire format based on what quoting it used)
Our files are already non-JSON due to comments (JSON has no notion of #
introducing a comment to ignore text to the next newline). But both our
use of comments and our use of ' instead of " can be remedied in a
one-pass sed script to get a true JSON output if such is needed, at
least as long as we don't need to quote any " characters in the schema.
Therefore, I agree that making the include syntax closer to true JSON is
desirable, whether or not we also decide to use " in the files to begin
with. I don't see any way around the fact that JSON doesn't define
comments, vs. our absolute need for comments in our schema files, though.
>>
>>> Our JSON parser accepts ' as an extension, to save us quoting in C
>>> strings. That reason doesn't apply to .json files.
>>
>> Is it a problem if they are not pure JSON? In the end, they are parsed by
>> qapi.py (which already knows about file syntax), and having a separate syntax
>> for includes makes it somewhat easier to spot when that happens.
>
> I don't particularly care whether schema syntax is pure JSON, some
> bastardized variation of JSON, or something else entirely. But as long
> as we advertize schema files it as .json, they better contain JSON. If
> they contain something else, they should be called something else.
Maybe .qapi? But the name qapi-schema.qapi sounds redundant...
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-03-03 17:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 15:53 [Qemu-devel] [PATCH v4 0/3] qapi: Allow modularization of QAPI schema files Lluís Vilanova
2014-02-28 15:53 ` [Qemu-devel] [PATCH v4 1/3] qapi: Use an explicit input file Lluís Vilanova
2014-03-01 8:35 ` Markus Armbruster
2014-03-03 14:25 ` Lluís Vilanova
2014-03-03 15:42 ` Markus Armbruster
2014-03-03 16:59 ` Lluís Vilanova
2014-03-04 13:17 ` Markus Armbruster
2014-03-05 0:58 ` Lluís Vilanova
2014-02-28 15:53 ` [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file Lluís Vilanova
2014-03-01 8:57 ` Markus Armbruster
2014-03-03 14:21 ` Lluís Vilanova
2014-03-03 15:27 ` Markus Armbruster
2014-03-03 17:04 ` Lluís Vilanova
2014-03-03 17:56 ` Eric Blake [this message]
2014-03-04 8:02 ` Markus Armbruster
2014-03-13 15:33 ` Benoît Canet
2014-03-13 15:54 ` Eric Blake
2014-03-13 18:05 ` Lluís Vilanova
2014-03-14 16:35 ` Benoît Canet
2014-03-14 20:24 ` Lluís Vilanova
2014-03-14 21:55 ` Benoît Canet
2014-03-17 14:20 ` Benoît Canet
2014-02-28 15:53 ` [Qemu-devel] [PATCH v4 3/3] qapi: Add tests for the "include" directive Lluís Vilanova
2014-02-28 16:18 ` [Qemu-devel] [PATCH v4 0/3] qapi: Allow modularization of QAPI schema files Eric Blake
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5314C244.5070805@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.