Re: __data__ object

Alex Russell <[email protected]>
Newsgroups gmane.comp.windows.devel.netwindows
Organization netWindows.org
Message-ID <[email protected]>
On Sunday 07 September 2003 19:13, Christian Boulanger wrote:
> Alex,
>
> There is one thing I have not quite understood about the data structure
> required by __data__: why the "nwComponent"/ "nwSubcomponent" part in the
> retrieved array? Couln'd nW parse the data structure into "real"
> associative arrays within associative arrays, like,
>
> { foo:"bar", foo2: { foo3:"bar", foo4:"baz"}, ....}
>
> So that I could call data.foo2.foo3 instead of data.
> nwComponents.subComponent[0].foo3 ?

Subcomponents are implicitly multi-valued. Consider that the parser always 
wants to allow multiple sub-components of the same type below a parent 
component, and that we don't want to change the calling semantics in systems 
where we don't know how many of an object there will be. An array is the 
simplest way to handle this case. Yes, it's kinda ugly for 
single-subcomponent cases, but it is less complex in the aggregate. 
Additionally, the current structure guards against the case where you might 
have a sub-component of type "foo2" but also an attribute of the same name in 
a parsed node. I'm more flexible on this point, since I do tend to think it 
would be kind of stupid to have both, and so we could eliminate at least one 
indirection.

What does everyone else think?

-- 
Alex Russell
[email protected]    BD10 7AFC 87F6 63F9 1691 83FA 9884 3A15 AFC9 61B7
[email protected]  F687 1964 1EF6 453E 9BD0 5148 A15D 1D43 AB92 9A46

_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.