qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] Non-flat command line option argument syntax


From: Eric Blake
Subject: Re: [Qemu-block] Non-flat command line option argument syntax
Date: Mon, 27 Feb 2017 13:43:23 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 02/27/2017 04:27 AM, Markus Armbruster wrote:
> Design flaw: there is no good way to denote an empty array or object
> other than the root object.
> 
> Empty KEY=VALUE,... is valid and results in an empty root object.
> 
> Presence of a KEY that contains periods results in additional non-root
> objects or arrays.  For instance, KEY a.b.c results in root object
> member "a" that has member "b" that has (scalar) member "c".
> 
> These additional objects and arrays all have at least one member, by
> construction.
> 
> Begs the question how to denote an empty object or array other than the
> root.

If a.b.c=1 means root object has member "a" with child object "b", and
object "b" has key "c" with scalar value, I suppose we could allow:

a.b,

(with no =val) to mean root object "a" has an empty child "b"
(indeterminate if "b" is an object or a list) - but only if we don't
allow the 'foo' => 'foo=on' magic already in use by QemuOpts.  And you
still have to figure out how to choose empty list vs. empty object.

> 
> Without additional syntax, all we can do is choose what exactly to make
> impossible:
> 
> * Absent key means absent, period.  No way to do empty array or object.
>   This is what I implemented.

I lean towards this meaning. It should generally possible to allow an
empty object/list to mean the same thing as an optional omitted
object/list in all contexts - so omitting KEY=VALUE for a list means you
are omitting the list, but the omitted list behaves the same as an
explicitly empty one would have done (even though dotted syntax doesn't
have an easy way to express an explicit empty list).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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