qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/28] tests/qapi-schema: Rework comments on longhand member


From: Eric Blake
Subject: Re: [PATCH 03/28] tests/qapi-schema: Rework comments on longhand member definitions
Date: Tue, 23 Mar 2021 08:58:37 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 3/23/21 8:00 AM, John Snow wrote:
> On 3/23/21 5:40 AM, Markus Armbruster wrote:
>> +# event 'data' member with dict value is (longhand) argument
>> +# definition, not inline complex type
> 
> I have to be a weenie and say I don't know exactly what this comment is
> telling me.
> 
> (1) What's a longhand argument?

Writing { 'type':'str', 'name':'foo' } is longhand for the corresponding
'foo':'str' shorthand.

> (2) What's an inline complex type?

Writing { 'command':'Foo', 'returns': { 'foo':'str' } }
or { 'union':'U', 'base': { 'foo':'Enum' } ... }

are inline complex types; they are shorthand for:

{ 'struct':'FooReturn', 'data': { 'foo':'str' } }
{ 'struct':'UBase', 'data': { 'foo':'Enum' } }
{ 'command':'Foo', 'returns':'FooReturn'  }
{ 'union':'U', 'base':'UBase' }

At one point, I had the idea that we might want to write:

{ 'union':'U', ...
  'data': { 'branch': { inline type } } }

instead of having to pre-declare the type for the branch; but that idea
is no longer feasible, since it would be awkward to distinguish from
what we DO have of:

{ 'union':'U', ...
  'data': { 'branch': { 'type':'Branch', 'if': 'COND' } } }

and where I don't really see us wanting:

{ 'union':U', ...
  'data': { 'branch': { 'type': { inline type }, 'if': 'COND' } } }

(If the situation changes and we do want anonymous inline types anywhere
a name can appear now, we'll have more work to do)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]