From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2c3g-0002ha-Hf for qemu-devel@nongnu.org; Fri, 26 Jul 2013 03:03:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2c3f-0003No-EP for qemu-devel@nongnu.org; Fri, 26 Jul 2013 03:03:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2c3f-0003Nk-6d for qemu-devel@nongnu.org; Fri, 26 Jul 2013 03:03:23 -0400 Date: Fri, 26 Jul 2013 15:03:19 +0800 From: Amos Kong Message-ID: <20130726070319.GC9320@amosk.info> References: <1373971062-28909-1-git-send-email-akong@redhat.com> <1373971062-28909-3-git-send-email-akong@redhat.com> <51E52504.5060306@redhat.com> <20130716110440.GC743@amosk.info> <51E529C7.4060108@redhat.com> <20130716120422.GA14541@amosk.info> <51E53A1D.2010103@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51E53A1D.2010103@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: armbru@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, lcapitulino@redhat.com On Tue, Jul 16, 2013 at 02:18:37PM +0200, Paolo Bonzini wrote: > Il 16/07/2013 14:04, Amos Kong ha scritto: > >> > Thanks. I see this is unique, but it is also not too intuitive. > >> > > >> > So, could you add a "kind" field to DataObject that is an enum > >> > (list/dict/scalar, or something like that)? This would make it easier > >> > to parse (for humans at least, but I guess also for programs). > > I thought we can identify the kind by some judgment. > > Yes, I understood that. Strictly speaking the kind is redundant, but it > seems to me that it makes the API easier to understand and use. > > > if the dict has key 'key', it's a dict > > if no 'key', have 'type', it's a list > > if only have 'type', it's a buildin type (or extended type that > > doesn't need to be extended) > > if no 'key', have 'type' & 'data', it's extended list type > > if have 'key', 'type', 'data', it's extended dict type > > > > I will added a 'kind' field to make it clearer. > > > > KIND enum: > > list > > dict > > str > > Why "str" and not "scalar" for a builtin type? It's not necessarily a > string, is it? right, 'scalar' is better. > Paolo > > > scalar(bool): Or just simplely check if have 'data' key? > > true/false -- Amos.