From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yc8ji-0005k1-7p for qemu-devel@nongnu.org; Sun, 29 Mar 2015 04:38:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yc8jf-0000lU-1t for qemu-devel@nongnu.org; Sun, 29 Mar 2015 04:38:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yc8je-0000lM-Ph for qemu-devel@nongnu.org; Sun, 29 Mar 2015 04:38:22 -0400 From: Markus Armbruster References: <1427227433-5030-1-git-send-email-eblake@redhat.com> <1427227433-5030-17-git-send-email-eblake@redhat.com> <87wq22ubb8.fsf@blackfin.pond.sub.org> <5515B553.2010606@redhat.com> Date: Sun, 29 Mar 2015 10:38:17 +0200 In-Reply-To: <5515B553.2010606@redhat.com> (Eric Blake's message of "Fri, 27 Mar 2015 13:53:55 -0600") Message-ID: <87h9t45hc6.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v5 16/28] qapi: Better error messages for duplicated expressions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wenchaoqemu@gmail.com, lcapitulino@redhat.com Eric Blake writes: > On 03/27/2015 01:52 AM, Markus Armbruster wrote: >> One more... >> >> Eric Blake writes: >> >> [...] >>> diff --git a/scripts/qapi.py b/scripts/qapi.py >>> index 90eb3bc..5d0dc91 100644 >>> --- a/scripts/qapi.py >>> +++ b/scripts/qapi.py >> [...] >>> @@ -560,12 +585,22 @@ def type_name(name): >>> return c_list_type(name[0]) >>> return name >>> >>> -enum_types = [] >>> -struct_types = [] >>> -union_types = [] >>> +def add_name(name, info, meta, implicit = False): >>> + global all_names >>> + if name in all_names: >>> + raise QAPIExprError(info, >>> + "%s '%s' is already defined" >>> + %(all_names[name], name)) >> >> We say "struct 'Foo'", and expect the user to know that 'struct' means >> 'complex type'. It'll do, it's just a development tool. > > In fact, I considered making it "type 'Foo'", to match that the item is > declared with { 'type':'Foo' ...} and not { 'struct':'Foo' ...}. But > type is an ambiguous word. I'm half tempted to do a global > search-and-replace of s/'type'/'struct'/ in the json files, since > 'union' is also a type. Obviously as its own patch. No objections. The churn will be a bit annoying with git-blame, but I'd prefer that to continuing with confusing terminology. >> >> I'm not really happy with 'complex type', though. Isn't a union type >> complex, too? Anyway, we can clean up our confused terminology later; >> this series is long enough. > > Hmm. If I _do_ the global rename, then we have a nice hierarchy: > > type - simple type: built-in, enum > - alternate > - complex type: struct, union Indeed. The odd in-between-ness of alternate here is additional justification for you separating it from union.