From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adJtq-0005xW-98 for qemu-devel@nongnu.org; Tue, 08 Mar 2016 10:50:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adJtk-0004kR-Am for qemu-devel@nongnu.org; Tue, 08 Mar 2016 10:50:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56915) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adJtk-0004kN-38 for qemu-devel@nongnu.org; Tue, 08 Mar 2016 10:50:12 -0500 References: <1457194595-16189-1-git-send-email-eblake@redhat.com> <1457194595-16189-4-git-send-email-eblake@redhat.com> <87io0xb5pc.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56DEF4B3.7000500@redhat.com> Date: Tue, 8 Mar 2016 08:50:11 -0700 MIME-Version: 1.0 In-Reply-To: <87io0xb5pc.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OUgETplKuKc5nBD1kKWg9AIkcWufWc0L6" Subject: Re: [Qemu-devel] [PATCH v4 03/10] qapi: Make c_type() more OO-like 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) --OUgETplKuKc5nBD1kKWg9AIkcWufWc0L6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/08/2016 03:54 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> QAPISchemaType.c_type() was a bit awkward. Rather than having two >> optional orthogonal boolean flags that should never both be true, >> and where all callers should pass a compile-time constant (well, >> our use of is_unboxed wasn't constant, but a future patch is about >> to remove the special case for simple unions, so we can live with >> the churn of refactoring the code in the meantime), the more >> object-oriented approach uses different method names that can be >> overridden as needed, and which convey the intent by the method >> name. The caller just makes sure to use the right variant, rather >> than having to worry about boolean flags. >> >> It requires slightly more Python, but is arguably easier to read. >=20 > The second sentence is rather long. Suggest: >=20 > QAPISchemaType.c_type() is a bit awkward: it takes two optional > boolean flags is_param and is_unboxed that should never both be > true. >=20 > Add a new method for each of the flags, and drop the flags from > c_type(). >=20 > Most calls pass no flags. They remain unchanged. >=20 > One call passes is_param=3DTrue. Call new .c_param_type() instead.= >=20 > One call passes is_unboxed=3DTrue except for simple union types. T= his > is actually an ugly special case that should go away soon. Until > then, we now have to call either .c_type() or the new > .c_unboxed_type(). Tolerable. Yes, that works for me. >=20 >> Suggested-by: Markus Armbruster >> Signed-off-by: Eric Blake >=20 > Patch looks good. >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --OUgETplKuKc5nBD1kKWg9AIkcWufWc0L6 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/ iQEcBAEBCAAGBQJW3vSzAAoJEKeha0olJ0NqsdgIAIOhhDHnWVfGxLQp8ZHx1YEb Wpbm1jbjB2SBtTyyeEcjfwKotq6xz+gf5NqhXm6SxqZWXTWrbWAH818t2ts7vaB+ dp/E+dfjDYi82J3PG09BzY0qBCm2BVVz3TWG4NMQR5gtQE+gdTRcwy91PYOnDh2W FZIB9QWlD/fADupU6Caoymw9tbl5yfqmlIWpQuH5lIg2HWZjIC8+UUTbGGkDtV3v 6INZOSnrGg2nBrcod7V4ySaXPVOJUOLXZOM1fL9ZikyneaDL8OuJ77mrVE+1a6Fp l9HPl+/ODR5UQ6kb4mleQAYwcGIRBIqorW7IRCwW0AEoQbgaeEDR4tjHPbjlZas= =yeoT -----END PGP SIGNATURE----- --OUgETplKuKc5nBD1kKWg9AIkcWufWc0L6--