[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order tr
From: |
Peter Maydell |
Subject: |
Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal |
Date: |
Mon, 11 Jul 2022 11:32:35 +0100 |
On Fri, 8 Jul 2022 at 12:01, Daniel P. Berrangé <berrange@redhat.com> wrote:
> What alternative options do we have for addressing this scenario.
>
> I can think of
>
> - Auto-create array elements, if seeing an element set before length.
>
> This is based on the theory that 'len-PROP' field is largely
> redundant. It is only needed if you want to create a sparse
> array, with empty elements /after/ the last one explicitly
> set, or if you want to get error reporting for an app setting
> element 3 after saying it wanted a 2 element list. IMHO the
> error reporting benefit is dubious, because the error scenario
> only exists because we made the app set this redundant 'len-PROP'
> attribute. Does anything actually need the 'sparse array'
> facility ?
I'm pretty sure that nothing needs sparse array elements like
that. The major reason for the len-PROP field is an implementation
one: because there is currently no way for a QOM object to
say "call this method if somebody tries to set a non-existent
property", the way array properties work is that the 'set'
method for the len-PROP property is the place where we then
add the PROP[0], PROP[1], ... properties.
If we either had a "call this for any property set/get attempt
where there is no specific method set" or else had array
properties supported by the core QOM code, we could avoid
having to set len-PROP first.
thanks
-- PMM
Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal, Peter Maydell, 2022/07/07
Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal, Daniel P . Berrangé, 2022/07/07
Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal, Daniel P . Berrangé, 2022/07/07
Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal, Alex Bennée, 2022/07/07