From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiCg8-0002pf-Fc for qemu-devel@nongnu.org; Fri, 02 Oct 2015 22:36:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZiCg3-0004h5-Gq for qemu-devel@nongnu.org; Fri, 02 Oct 2015 22:36:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiCg3-0004gS-BE for qemu-devel@nongnu.org; Fri, 02 Oct 2015 22:35:59 -0400 References: <1443760312-656-1-git-send-email-eblake@redhat.com> <1443760312-656-8-git-send-email-eblake@redhat.com> <87bnch76hs.fsf@blackfin.pond.sub.org> <560E9ECE.9050904@redhat.com> <87twq9nqjn.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <560F28CD.2090807@redhat.com> Date: Fri, 2 Oct 2015 19:01:01 -0600 MIME-Version: 1.0 In-Reply-To: <87twq9nqjn.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Kfc6nFofmoGjqkFLaiSDXhF2mHd120UDG" Subject: Re: [Qemu-devel] [PATCH v6 07/12] qapi: Detect collisions in C member names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Michael Roth , marcandre.lureau@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Kfc6nFofmoGjqkFLaiSDXhF2mHd120UDG Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/02/2015 11:11 AM, Markus Armbruster wrote: >>> Why wrap function c_name() in a method? Why not simply call the >>> function? >> >> 'self.c_name()' is shorter than 'c_name(self.name)'. And I already ha= d >> long lines with that seen[self.c_name()].describe() pattern. >=20 > You could also try a local variable: cnam =3D c_name(self.name). >=20 >>> It's method in QAPISchemaEntity only because this lets us add special= >>> cases in a neat way. >> >> True, but I _did_ mention in the commit message that I did it for less= >> typing. >> >> But as to special cases, yes, I have one in mind (although I have not >> played with it yet). >=20 > I'm afraid I don't have enough context to grok this late on Friday :) Here's another case I have in mind. Right now, we have special code littered in qapi-types and qapi-visit to track that the QAPISchemaObjectTypeMember for simple unions is named 'type' in QMP but 'kind' in C code. Having member.c_name() return 'kind' would simplify that code. So, what I will do for v7 is rework the patches to independently implement and use member.c_name() (possibly by also creating a special subclass of QAPISchemaObjectTypeMember), showing how it makes the clients easier, and then this patch can also make use of that work. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Kfc6nFofmoGjqkFLaiSDXhF2mHd120UDG 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/ iQEcBAEBCAAGBQJWDyjNAAoJEKeha0olJ0Nq6YEIAIWaVRMg8Dd3syAgptqDIoG/ IvN7mIVzpfl7p/+vo8kgDxklEOZq678HJDSNiJwz4PJ/mfFcQtJxhKt6pkrFcEQV rPqpZl+XLYFa5WJZfTKDnpQoYqHgub/31mj7XDq1wOOsQU3AHvaxCY3U0L80JP9M ClwakuxnRHNwryIuKNhZUkwcc/KEe0r+3+lK4uf/OJ3u9QPdzE2zf6HSimwgARnu XsqYjuW32clCrACA+ndyTS/nT5KbuvB+nohnheA6vu8DourJItyuchTwmcleBej3 cWiSHygrhDP8pS9fmsuEPi+7nXR6X3+LDLGFNMS/KN/iGhUmJt38Hi/Hd8wuKzw= =yVr8 -----END PGP SIGNATURE----- --Kfc6nFofmoGjqkFLaiSDXhF2mHd120UDG--