From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz4DS-0004tz-BX for qemu-devel@nongnu.org; Tue, 16 Jul 2013 08:18:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uz4DQ-0000Bp-FR for qemu-devel@nongnu.org; Tue, 16 Jul 2013 08:18:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz4DQ-0000BH-0X for qemu-devel@nongnu.org; Tue, 16 Jul 2013 08:18:48 -0400 Message-ID: <51E53A1D.2010103@redhat.com> Date: Tue, 16 Jul 2013 14:18:37 +0200 From: Paolo Bonzini MIME-Version: 1.0 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> In-Reply-To: <20130716120422.GA14541@amosk.info> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Amos Kong Cc: armbru@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, lcapitulino@redhat.com 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? Paolo > scalar(bool): Or just simplely check if have 'data' key? > true/false