From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v4 03/10] qapi: Make c_type() more OO-like
Date: Tue, 08 Mar 2016 11:54:23 +0100 [thread overview]
Message-ID: <87io0xb5pc.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1457194595-16189-4-git-send-email-eblake@redhat.com> (Eric Blake's message of "Sat, 5 Mar 2016 09:16:28 -0700")
Eric Blake <eblake@redhat.com> writes:
> 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.
The second sentence is rather long. Suggest:
QAPISchemaType.c_type() is a bit awkward: it takes two optional
boolean flags is_param and is_unboxed that should never both be
true.
Add a new method for each of the flags, and drop the flags from
c_type().
Most calls pass no flags. They remain unchanged.
One call passes is_param=True. Call new .c_param_type() instead.
One call passes is_unboxed=True except for simple union types. This
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.
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
Patch looks good.
next prev parent reply other threads:[~2016-03-08 10:54 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-05 16:16 [Qemu-devel] [PATCH v4 00/10] easier unboxed visits/qapi implicit types Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 01/10] qapi: Assert in places where variants are not handled Eric Blake
2016-03-08 10:12 ` Markus Armbruster
2016-03-08 15:49 ` Eric Blake
2016-03-08 17:46 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 02/10] qapi: Fix command with named empty argument type Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 03/10] qapi: Make c_type() more OO-like Eric Blake
2016-03-08 10:54 ` Markus Armbruster [this message]
2016-03-08 15:50 ` Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 04/10] qapi: Emit implicit structs in generated C Eric Blake
2016-03-08 14:24 ` Markus Armbruster
2016-03-08 16:03 ` Eric Blake
2016-03-08 19:09 ` Markus Armbruster
2016-03-09 5:42 ` Eric Blake
2016-03-09 7:23 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 05/10] qapi: Utilize implicit struct visits Eric Blake
2016-03-08 15:10 ` Markus Armbruster
2016-03-08 16:11 ` Eric Blake
2016-03-08 18:09 ` Markus Armbruster
2016-03-08 18:28 ` Eric Blake
2016-03-08 19:21 ` Markus Armbruster
2016-03-09 23:28 ` Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 06/10] qapi-commands: Inline single-use helpers of gen_marshal() Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 07/10] qapi: Don't special-case simple union wrappers Eric Blake
2016-03-08 15:59 ` Markus Armbruster
2016-03-08 16:16 ` Eric Blake
2016-03-08 18:10 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 08/10] qapi: Allow anonymous base for flat union Eric Blake
2016-03-08 16:23 ` Markus Armbruster
2016-03-08 16:29 ` Eric Blake
2016-03-08 18:14 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 09/10] qapi: Use anonymous bases in QMP flat unions Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 10/10] qapi: Populate info['name'] for each entity Eric Blake
2016-03-08 16:46 ` Markus Armbruster
2016-03-08 16:59 ` Eric Blake
2016-03-08 19:14 ` Markus Armbruster
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=87io0xb5pc.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=mdroth@linux.vnet.ibm.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.