From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zx6yv-0003Ze-B2 for qemu-devel@nongnu.org; Fri, 13 Nov 2015 00:33:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zx6yq-0006Pd-9P for qemu-devel@nongnu.org; Fri, 13 Nov 2015 00:33:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zx6yq-0006PZ-21 for qemu-devel@nongnu.org; Fri, 13 Nov 2015 00:33:00 -0500 References: <1447224690-9743-1-git-send-email-eblake@redhat.com> <1447224690-9743-21-git-send-email-eblake@redhat.com> <878u64bn9n.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56457603.4010309@redhat.com> Date: Thu, 12 Nov 2015 22:32:51 -0700 MIME-Version: 1.0 In-Reply-To: <878u64bn9n.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="29KaW7lOlbrPT6KF5QhP4KoEPKS8OhQL2" Subject: Re: [Qemu-devel] [PATCH v11 20/28] qapi: Forbid case-insensitive clashes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --29KaW7lOlbrPT6KF5QhP4KoEPKS8OhQL2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/11/2015 07:53 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> In general, designing user interfaces that rely on case >> distinction is poor practice. Another benefit of enforcing >> a restriction against case-insensitive clashes is that we >> no longer have to worry about the situation of enum values >> that could be distinguished by case if mapped by c_name(), >> but which cannot be distinguished when mapped to C as >> ALL_CAPS by camel_to_upper(). >=20 > With PATCH 19, they're mapped by c_name(N).upper(). >=20 Yep, need to reword that, thanks to rebase churn. >> Thus, having the generator >> look for case collisions up front will prevent developers >> from worrying whether different munging rules for member >> names compared to enum values as a discriminator will cause >> any problems in qapi unions. >> >> There is also the possibility that we may want to add a >> future extension to QMP of teaching it to be case-insensitive >> (the user could request command 'Quit' instead of 'quit', or >> could spell a struct field as 'CPU' instead of 'cpu'). But >> for that to be a practical extension, we cannot break >> backwards compatibility with any existing struct that was >> already relying on case sensitivity. Fortunately, after the >> previous patch cleaned up CpuInfo, there are no such existing >> qapi structs. Of course, the idea of a future extension is >> not as strong of a reason to make the change. >> >> At any rate, it is easier to be strict now, and relax things >> later if we find a reason to need case-sensitive QMP members, >> than it would be to wish we had the restriction in place. >=20 > Suggest to briefly mention the new test. Will do. >=20 >> Signed-off-by: Eric Blake >=20 > Patch looks good. >=20 Hmm - this only enforces member name case clashes. It would also be worth enforcing command/event/type collisions (technically, only command/event clashes are user-visible, but tracking all entities is probably easier) - probably by modifying QAPISchema._def_entity() and =2Elookup_entity() to do the same trick of keying the map by a munged name. I'll see about adding that as an additional patch. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --29KaW7lOlbrPT6KF5QhP4KoEPKS8OhQL2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWRXYDAAoJEKeha0olJ0NqFnIIAKmCRo8iyjJftzJmIGmgJm69 fBfa75/0vWxUqBXeBNQvL0IwyoWNMWjTL2DcyRAQXw3IzbMNcnilAt+9SXCN0/3O 09kzNyyYMFA57Te/0Pzdla7oGUkDnGDEillG08U4bGbH8a9uslyZw1Oysy0uYjXR TEBIHD6dBgPen2XOfnT2GUYEQ0lj6Qr6oLEKHoo1TckPv8m0YrRZLT24Py4zp3ea hnEJh+pdLyrvA+MMrmRITPMG2vuoSCL6FfHfbG9pVhUrf5YLCjdvUCmZaYRfJxgV xvsbn0489JS1yhUZO9rpFS6lo/RjRoCJHKf78gIObBvAopRhChlaEIID+3RuL+A= =LRxV -----END PGP SIGNATURE----- --29KaW7lOlbrPT6KF5QhP4KoEPKS8OhQL2--