From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKX6M-000119-BO for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:56:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKX6H-0000Ev-8r for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:56:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKX6H-0000Ek-0Y for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:56:25 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s23HuM0C013489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 3 Mar 2014 12:56:23 -0500 Message-ID: <5314C244.5070805@redhat.com> Date: Mon, 03 Mar 2014 10:56:20 -0700 From: Eric Blake MIME-Version: 1.0 References: <20140228155309.28087.96600.stgit@fimbulvetr.bsc.es> <20140228155321.28087.44860.stgit@fimbulvetr.bsc.es> <87eh2mgusw.fsf@blackfin.pond.sub.org> <87d2i3z7l0.fsf@fimbulvetr.bsc.es> <8738izxpyb.fsf@blackfin.pond.sub.org> In-Reply-To: <8738izxpyb.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Op6gsa3RfGSdNNdEkuUltLSlJqSj53ICj" Subject: Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Op6gsa3RfGSdNNdEkuUltLSlJqSj53ICj Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 sa= ne >>> 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. >=20 > 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... --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Op6gsa3RfGSdNNdEkuUltLSlJqSj53ICj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTFMJEAAoJEKeha0olJ0Nqcz4H/2MeSNDq44DDITKy0yw1zZAk Asd/Mv4dQ3nQPq2DdmYIXPl3FrfKT52lPcIPcVoVv8LDV4mtre+BhPfAHoKPBcqm QbVuuQZZgoJ+BhA2fitM+4VsvJ4X5d+avAbpobpdmyb7Dm0A3Qcsliov2T6YbOQF H5wLxQj/kd5DNMNgwZbXhHURn9w6/f+Mj5pX6t9hEuLTjeBpdv6NtvyTNTFac/DI ns37AMcPFKMC4l7bnNr/KhjgHoUFv5lV2aTpic+PFZQ0dRM3iaWZKBW9quytzn4O RylOM9iuqRYN8K3j3ORgcHBQP8bsL35wPTwQHiA41EsW9bOZeGg56rJmHaqIVN4= =on+s -----END PGP SIGNATURE----- --Op6gsa3RfGSdNNdEkuUltLSlJqSj53ICj--