qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH v2 0/7] qapi: Specify default value for optional argument in schema json
Date: Wed, 21 May 2014 16:42:25 +0800	[thread overview]
Message-ID: <20140521084225.GA13469@T430.nay.redhat.com> (raw)
In-Reply-To: <20140521082307.GA3579@noname.redhat.com>

On Wed, 05/21 10:23, Kevin Wolf wrote:
> Am 21.05.2014 um 09:46 hat Markus Armbruster geschrieben:
> > Fam Zheng <famz@redhat.com> writes:
> > 
> > > On Wed, 05/21 07:54, Markus Armbruster wrote:
> > >> Fam Zheng <famz@redhat.com> writes:
> > >> 
> > >> > On Tue, 05/20 13:13, Eric Blake wrote:
> > >> >> On 05/20/2014 03:07 AM, Fam Zheng wrote:
> > >> >> > Please first take a look at patch 7 to see what is supported by this series.
> > >> >> > 
> > >> >> > Patch 1 ~ 3 allows some useful basic types in schema.
> > >> >> > 
> > >> >> > Patch 4 ~ 6 implements the new syntax.
> > >> >> > 
> > >> >> > Note: The introduced '@arg' sigil, just like the preexisting '*arg', is
> > >> >> > reducing the cleanness of the syntax. We should get rid of both of them in long
> > >> >> > term. Here, this series compromises on this and introduces '@arg' because:
> > >> >> > 
> > >> >> >   - We have to distinguish the argument property dictionary from nested struct:
> > >> >> > 
> > >> >> >     I.e.:
> > >> >> > 
> > >> >> >         'data': {
> > >> >> >             'arg1': { 'member1': 'int', 'member2': 'str' }
> > >> >> >             '@arg2': { 'type': 'int', 'default': 100 }
> > >> >> >          }
> > >> >> > 
> > >> >> >     Until we completely drop and forbid the 'arg1' nested struct use case.
> > >> >> > 
> > >> >> >   - Forbidding 'arg1' it's doable, but doing it now means we pull in many
> > >> >> >     distractive patches to this series.
> > >> >> 
> > >> >> Question - since we WANT to get rid of nested struct, why not reverse
> > >> >> the sense?  Mark all existing nested structs (weren't there just three
> > >> >> that we found?) with the '@' sigil, and let the new syntax be
> > >> >> sigil-free.  Then when we clean up the nesting, we are also getting rid
> > >> >> of the bad syntax, plus the sigil gives us something to search for in
> > >> >> knowing how much to clean up.  But if you stick the sigil on the new
> > >> >> code, instead of the obsolete code, then as more and more places in the
> > >> >> schema use defaults, it gets harder and harder to remove the use of the
> > >> >> sigil even if the nested structs are eventually removed.
> > >> >> 
> > >> >
> > >> > It makes not much difference I can see. The hard part is actaully dropping
> > >> > nested, converting from sigil <-> non-sigil is easy. Of course, nothing is
> > >> > seriously hard, there are only three nested structs plus some more
> > >> > qapi-schema
> > >> > test code.
> > >> 
> > >> Adding three ugly sigils and making everybody include one when they add
> > >> a nested struct feels much better to me than ugly sigils all over the
> > >> place.
> > >
> > > Well, I could use some background here. Why did we introduce nested structure
> > > in the first place?
> > 
> > Because we could?
> > 
> > Felt like a good idea at the time?
> > 
> > I quick glance at commit 0f923be and fb3182c suggests they have been
> > supported since the beginning.  There is no design rationale.
> 
> Let me extend Fam's question: Why don't we simply remove them right
> now? If it's really only three instances, converting them to full
> types should be a matter of five minutes.
> 

Actually, my question is: do we want it independently, or do we want to include
the removal of nested as the first part of this series?

I would prefer the former because I feel uncomfortable with making more changes
in this series, since there are already many things to do: adding qapi types,
adding argument property dict, adding all test cases for all of them, updating
documentation, and apply the new syntax in qapi-schema.json. A non-RFC revision
could be long and hard to review.

Fam

  reply	other threads:[~2014-05-21  8:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20  9:07 [Qemu-devel] [RFC PATCH v2 0/7] qapi: Specify default value for optional argument in schema json Fam Zheng
2014-05-20  9:07 ` [Qemu-devel] [RFC PATCH v2 1/7] qapi: Allow decimal values Fam Zheng
2014-05-20 15:11   ` Eric Blake
2014-05-20  9:07 ` [Qemu-devel] [RFC PATCH v2 2/7] qapi: Allow true, false and null in schema json Fam Zheng
2014-05-20 19:20   ` Eric Blake
2014-05-20  9:07 ` [Qemu-devel] [RFC PATCH v2 3/7] tests: Add decimal test cases for qapi-schema Fam Zheng
2014-05-20 12:43   ` Eric Blake
2014-05-20  9:07 ` [Qemu-devel] [RFC PATCH v2 4/7] qapi: Add c_val(t, val) for int Fam Zheng
2014-05-20  9:07 ` [Qemu-devel] [RFC PATCH v2 5/7] qapi: Add @arg property dictionary syntax Fam Zheng
2014-05-20  9:08 ` [Qemu-devel] [RFC PATCH v2 6/7] qapi: Initialize argument value in generated code if has 'default' Fam Zheng
2014-05-20  9:08 ` [Qemu-devel] [RFC PATCH v2 7/7] qmp: Convert block-commit speed to arg property dict Fam Zheng
2014-05-20  9:16 ` [Qemu-devel] [RFC PATCH v2 0/7] qapi: Specify default value for optional argument in schema json Fam Zheng
2014-05-20 19:13 ` Eric Blake
2014-05-21  1:59   ` Fam Zheng
2014-05-21  5:54     ` Markus Armbruster
2014-05-21  7:09       ` Fam Zheng
2014-05-21  7:46         ` Markus Armbruster
2014-05-21  8:23           ` Kevin Wolf
2014-05-21  8:42             ` Fam Zheng [this message]
2014-05-21  9:01               ` Kevin Wolf
2014-05-21 11:32               ` Eric Blake
2014-05-21  9:35             ` 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=20140521084225.GA13469@T430.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).