Received: from eggs.gnu.org ([2001:4830:134:3::10]:42878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Whgze-0005AO-TE for qemu-devel@nongnu.org; Tue, 06 May 2014 11:09:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhgzY-0000ka-J9 for qemu-devel@nongnu.org; Tue, 06 May 2014 11:09:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhgzY-0000kG-BV for qemu-devel@nongnu.org; Tue, 06 May 2014 11:09:12 -0400 From: Markus Armbruster References: <1398764656-27534-1-git-send-email-famz@redhat.com> <1398764656-27534-3-git-send-email-famz@redhat.com> <8761lktrg3.fsf@blackfin.pond.sub.org> <5367ABE0.6040104@redhat.com> <87iopkdt9g.fsf@blackfin.pond.sub.org> <536818AA.50101@redhat.com> <874n131ba8.fsf@blackfin.pond.sub.org> <5368D725.3080109@redhat.com> Date: Tue, 06 May 2014 17:09:04 +0200 In-Reply-To: <5368D725.3080109@redhat.com> (Eric Blake's message of "Tue, 06 May 2014 06:35:49 -0600") Message-ID: <87r447q6zz.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 2/2] qapi: Allow setting default values for optional parameters List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Peter Maydell , Fam Zheng , Michael Roth , qemu-devel@nongnu.org, Luiz Capitulino , akong@redhat.com Eric Blake writes: > On 05/06/2014 03:55 AM, Markus Armbruster wrote: > >>> Keeping the input file easy to write, and more compact than what >>> introspection will output, is a fine tradeoff in my book (easier to >>> maintain if there is less to type; while still having a well-defined >>> conversion to the formal output form). >> >> Unlike the other sugared form, this one adds syntax beyond JSON, namely >> in some (but not all) member names, and that makes it a bit harder to >> stomach for me. > > JSON has no requirement that a 'name':'value' object limit the 'name' > portion to just valid identifier characters. But I do see your point > about the fact that we are parsing a sigil of '*' as the first character > of 'name' as sugar. > >> >> Whether it's worthwhile depends on how common the case "optional, no >> default" turns out to be. Wait and see. > > It's already VERY common - every optional variable already uses the > syntax. The question is rather: how many optional variables will be > rewritten to express a default value, vs. those that can be left alone > because the default value is good enough. That's precisely the question. I like explicit defaults in the schema, they're fine documentation. They can also simplify code. > A global search-and-replace > could rewrite the entire file to the new syntax for optional variables, > and we could enforce the new more verbose style going forward, but is > the churn worth it? Wait and see how many optionals pick up defaults. The more do, the less churn.