qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2] qapi, qemu-options: make all parsing visitors parse boole


From: Paolo Bonzini
Subject: Re: [PATCH v2] qapi, qemu-options: make all parsing visitors parse boolean options the same
Date: Tue, 3 Nov 2020 17:33:47 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

On 03/11/20 17:25, Daniel P. Berrangé wrote:
>> OptsVisitor, StringInputVisitor and the keyval visitor have
>> three different ideas of how a human could write the value of
>> a boolean option.  Pay homage to the backwards-compatibility
>> gods and make the new common helper accept all four sets (on/off,
>> true/false, y/n and yes/no), and case-insensitive at that.
>>
>> Since OptsVisitor is supposed to match qemu-options, adjust
>> it as well.
> FWIW, libvirt does not appear to use true/false or y/n, nor
> ever use uppercase / mixed case.
> 
> IOW this level of back compat may well be overkill.
> 
> I'd particular suggest deprecating case-insensitivity, as
> Yes, YES, yEs feel unlikely to be important or widely used.

True; at least it's type-safe code unlike the short-form boolean option.
 It only hurts in the odd case of a boolean option becoming on/off/auto
or on/off/split.

I didn't want to introduce deprecation at this point, because
consistency is better anyway even if we plan to later deprecate
something.  For example, since there is a common parser now, introducing
deprecation would be much easier.  It also lets us switch parsers even
during the deprecation period (which is how I got into this mess).

Paolo




reply via email to

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