[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH] qom: Rename object_new_with_props to object
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC PATCH] qom: Rename object_new_with_props to object_new_child |
Date: |
Fri, 17 Aug 2018 12:52:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 17/08/2018 12:04, Daniel P. Berrangé wrote:
> On Fri, Aug 17, 2018 at 10:59:44AM +0100, Daniel P. Berrangé wrote:
>> On Fri, Aug 17, 2018 at 11:58:07AM +0200, Thomas Huth wrote:
>>> On 08/17/2018 11:48 AM, Daniel P. Berrangé wrote:
>>>> On Fri, Aug 17, 2018 at 09:33:33AM +0200, Thomas Huth wrote:
>>>>> While adding the object_initialize_child() function, Paolo suggested
>>>>> to rename the similar object_new_with_props() function accordingly:
>>>>>
>>>>> http://marc.info/address@hidden
>>>>>
>>>>> This way it is more obvious that this function creates a new object
>>>>> as a child of another object.
>>>>
>>>> I'd expect 'object_new_with_child' to be the same as 'object_new',
>>>> but with only 'parent' & 'id' args added, which isn't the case here.
>>>>
>>>> If we want the full & consistent design then we should have
>>>>
>>>> object_new(typename)
>>>> object_new_with_child(typename, parent, id)
>>>> object_new_props(typename, ...)
>>>> object_new_propv(typename, va_arg props)
>>>> object_new_with_child_props(typename, parent, id, ...)
>>>> object_new_with_child_propv(typename, parent, id, va_arg props)
>>>
>>> "new_with_child" sounds wrong, too, since the parent is not created
>>> here, but the child. Anyway, I guess the naming of these functions is
>>> too much subject to bikeshedding, so never mind, let's keep it as it
>>> currently is.
>>
>> True, 'new_with_parent' is a better choice in retrospect :-)
>
> Or indeed 'object_new_child' and 'object_new_child_prop{s,v}' approx as
> you had suggested
That would work for me too. Really anything works as long as the
initialize and new names are consistent.
In practice object_new_child would be unused, hence the shortcut of
adding the props argument directly to object_new_child{,v}.
Thanks,
Paolo