Received: from eggs.gnu.org ([2001:4830:134:3::10]:57187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn1F0-0002zl-7j for qemu-devel@nongnu.org; Wed, 21 May 2014 03:47:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wn1Es-0002LZ-Q7 for qemu-devel@nongnu.org; Wed, 21 May 2014 03:47:10 -0400 Received: from oxygen.pond.sub.org ([144.76.244.19]:38121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn1Es-0002LQ-KB for qemu-devel@nongnu.org; Wed, 21 May 2014 03:47:02 -0400 Received: from blackfin.pond.sub.org (p5B32BDDF.dip0.t-ipconnect.de [91.50.189.223]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by oxygen.pond.sub.org (Postfix) with ESMTPSA id 0D25C2492E for ; Wed, 21 May 2014 09:46:59 +0200 (CEST) From: Markus Armbruster References: <1400576881-6954-1-git-send-email-famz@redhat.com> <537BA947.9090800@redhat.com> <20140521015912.GC18886@T430.nay.redhat.com> <87y4xv8ymp.fsf@blackfin.pond.sub.org> <20140521070911.GH18886@T430.nay.redhat.com> Date: Wed, 21 May 2014 09:46:59 +0200 In-Reply-To: <20140521070911.GH18886@T430.nay.redhat.com> (Fam Zheng's message of "Wed, 21 May 2014 15:09:11 +0800") Message-ID: <87lhtv60b0.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [RFC PATCH v2 0/7] qapi: Specify default value for optional argument in schema json List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi Fam Zheng writes: > On Wed, 05/21 07:54, Markus Armbruster wrote: >> Fam Zheng 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. [...]