EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2016
01:24 AM
roSgNode implements ifAssociativeArray ?
It seem that roSgNode (AKA everything RSG) implements ifAssociativeArray? Is this intentional and official - or is it a leaky abstraction or subject to change?
Coincidentally i discovered today that a node responds to .count(), then to .doesExist() - and decided to dig futher some more:
Coincidentally i discovered today that a node responds to .count(), then to .doesExist() - and decided to dig futher some more:
BrightScript Debugger> o = createObject("roSgNode", "Node"): ? o
<Component: roSGNode> =
{
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id:
}
BrightScript Debugger> ? o.count()
4
BrightScript Debugger> ? o.doesExist("id")
true
BrightScript Debugger> ? getInterface(o, "ifAssociativeArray")
<Interface: ifAssociativeArray>
4 REPLIES 4


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2016
09:50 AM
Re: roSgNode implements ifAssociativeArray ?
"EnTerr" wrote:
It seem that roSgNode (AKA everything RSG) implements ifAssociativeArray? Is this intentional and official - or is it a leaky abstraction or subject to change?
It is intentional and official. The SDK docs have been updated now.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2016
11:29 AM
Re: roSgNode implements ifAssociativeArray ?
"RokuKC" wrote:
It is intentional and official. The SDK docs have been updated now.
Thank you for the direct answer!
Hmmm... this further raises unexpected questions though:
- What does roSgNode.clear() do? It seems to erase all fields - but what is "all" when there is nested-component inheritance? Also what about the baked-in fields?
- What does roSgNode.append() do? Is it alias to roSgNode.addFields() mish-mash maker?
PS. I assure you this was not a trick question - when i noticed the .count() works, i thought "ha, roSgNode tighty whities are showing", i.e. implementation details are leaking out. Turns out it was fashion and jeans were supposed to hang low 🙂


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2016
02:07 PM
Re: roSgNode implements ifAssociativeArray ?
"EnTerr" wrote:
- What does roSgNode.clear() do? It seems to erase all fields - but what is "all" when there is nested-component inheritance? Also what about the baked-in fields?
- What does roSgNode.append() do? Is it alias to roSgNode.addFields() mish-mash maker?
clear() can only delete dynamically added fields.
append() can be considered an alias to addFields().
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2016
05:52 PM
Re: roSgNode implements ifAssociativeArray ?
"RokuKC" wrote:
clear() can only delete dynamically added fields.
Hmm, in my tests it also deletes the static-added fields; as in, this kind:
<interface>
<field id="foo" type="assocarray" onChange="bar"/>
</interface>