On 10/19/2015 10:14 AM, Markus Armbruster wrote: > Eric Blake <ebl...@redhat.com> writes: > >> We already reserved '*Kind' for implicit enums (since commit > > "We reserved '*Kind' since" sounds odd. Present tense? > >> 4dc2e69), but failed to reserve '*List' for array types. Since >> no QMP was yet using it, we might as well make the reservation >> official. > > Uhm, how can we fail to reserve something, and then make the reservation > official? I think what you're trying to say is something like > > Type names ending in 'List' can clash with array types in generated > C. We don't currently use such names. Outlaw them. > > Precedence: commit 4dc2e69 outlawed names ending in 'Kind', because > they can clash with implicit enum types of unions. >
Okay, your wording has some improvements. I'll take those ideas and try again. >> Note that this forbids creation of new types or commands ending >> in 'List', but does NOT forbid abuse of attempts like ['intList'] >> for creating a 2-dimensional array of 'int'. > > Really? If I write ['T'], then T must be a declared type, mustn't it? > And after this patch, I cant declare type intList, can I? You can't declare { 'struct': 'intList' }, but I was worried whether you can abuse the type system by using { 'struct':'S', 'data': { 'two-d':['intList'] } }. But I guess I should actually test things rather than trying to mis-remember past conversations; a quick test shows: /home/eblake/qemu/tests/qapi-schema/qapi-schema-test.json:10: Member 'two-d' of 'data' for struct 'S' uses unknown type 'intList' so what we were experimenting with earlier was [['int']] and not ['intList']. I'll update the paragraph accordingly. > >> The whole idea of >> multi-dimensional arrays needs more design thought, best left for >> another day. >> >> Signed-off-by: Eric Blake <ebl...@redhat.com> > > Patch looks good to me. > -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature