On 11/18/2015 03:09 PM, Eric Blake wrote:
> On 11/18/2015 10:08 AM, Markus Armbruster wrote:
>> Eric Blake <ebl...@redhat.com> writes:
>>
>>> In general, designing user interfaces that rely on case
>>> distinction is poor practice.  Another benefit of enforcing
>>> a restriction against case-insensitive clashes is that we
>>> no longer have to worry about the situation of enum values
>>> that could be distinguished by case if mapped by c_name(),
>>> but which cannot be distinguished when mapped to C as
>>> ALL_CAPS by c_enum_const() [via c_name(name, False).upper()].
>>> Thus, having the generator look for case collisions up front
>>> will prevent developers from worrying whether different
>>> munging rules for member names compared to enum values as a
>>> discriminator will cause any problems in qapi unions.
>>>
> 

>> Another possible improvement is hiding the case-folding logic in
>> methods.  Have a QAPISchemaEntity.c_namecase() that returns
>> self.c_name().lower().  Overwrite it in QAPISchemaEvent to return
>> .upper() instead.  Use it to make _def_entity() less ugly.
>>
>> Probably not worthwhile unless more uses of .c_namecase() pop up.
> 
> I kind of like it. I think I'll propose a 26.5 that implements that,
> then redo 27 on top of it (without reposting the entire series).

Actually, it's not worth splitting that into a separate patch (it was
just 6 lines, and I couldn't find any other uses).

-- 
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