Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Komag
Roku Guru

Jan 13 update - Nice Debug console improvements - "count"?

I just wanted to say that I already like the debug console improvements with better information from a crash.

Question - what is "count" after "refcnt"?
Example, two lines for me say:
sy               roAssociativeArray refcnt=4 count:12
id roArray refcnt=2 count:1

PS - my code seems a bit faster - for instance, one startup timer I noticed now takes 19ms every time, whereas it used to take usually 21-22ms in previous days. If that's improved everywhere, nice work, and extra 5-10% is welcome 🙂
0 Kudos
9 REPLIES 9
RokuMarkn
Visitor

Re: Jan 13 update - Nice Debug console improvements - "count

count is the number of items in the container. It's printed for roArray, roAssociativeArray and roList.

--Mark
0 Kudos
Komag
Roku Guru

Re: Jan 13 update - Nice Debug console improvements - "count

Ah, I see, my sy Associative Array has 12 key/value pairs inside, yes.
Can we count AA's? I only saw .Count() documented for Arrays, not AA's.
0 Kudos
TheEndless
Channel Surfer

Re: Jan 13 update - Nice Debug console improvements - "count

Best debug console update is the fact that it doesn't exit the channel when you break into it now!

"Komag" wrote:
Can we count AA's?
.Count() is available for AAs now. Indexers are also available (i.e., AA[1])
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Komag
Roku Guru

Re: Jan 13 update - Nice Debug console improvements - "count

Does that mean they're no longer "random"? Alphabetical? How can we reasonably make use of indexers
0 Kudos
TheEndless
Channel Surfer

Re: Jan 13 update - Nice Debug console improvements - "count

"Komag" wrote:
Does that mean they're no longer "random"? Alphabetical? How can we reasonably make use of indexers

They've never been "random" as the keys are always enumerated in the same order (no idea what that order is). I have no idea how you'd use indexers... I just noticed it by accident while debugging something the other day.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
EnTerr
Roku Guru

Re: Jan 13 update - Nice Debug console improvements - "count

"TheEndless" wrote:
Best debug console update is the fact that it doesn't exit the channel when you break into it now!
Peace and blessings be upon them, indeed! --Charlie

"Komag" wrote:
Can we count AA's?
Unofficially it has been in a beta for couple of months, see viewtopic.php?f=34&t=75809&p=463321#p462756
It was documented yesterday in ifAssociativeArray

"TheEndless" wrote:
Indexers are also available (i.e., AA[1])
Hmmm. What firmware would that be that you are talking about? Does not work on 6.1.5518:
BrightScript Debugger> a = {a:1, b:2}
BrightScript Debugger> ? a[0]
Type Mismatch. (runtime error &h18) in $LIVECOMPILE(482)


"TheEndless" wrote:
"Komag" wrote:
Does that mean they're no longer "random"? Alphabetical? How can we reasonably make use of indexers

They've never been "random" as the keys are always enumerated in the same order (no idea what that order is). I have no idea how you'd use indexers... I just noticed it by accident while debugging something the other day.

Ummmm, not quite. The enumeration order of hash/dictionary traditionally is pseudo-random but is not guaranteed to remain the same. What is guaranteed is that enumeration will go through all elements (in some arbitrary order - and in some implementations on condition the AA is not modified during the enumeration). I doubt RokuCo would like to codify that enumeration is in the same order. I also have serious doubts about usefulness of what you call "indexers" but looking forward to hear more
0 Kudos
TheEndless
Channel Surfer

Re: Jan 13 update - Nice Debug console improvements - "count

"EnTerr" wrote:
Hmmm. What firmware would that be that you are talking about? Does not work on 6.1.5518:

I'll need to double check, but I'm pretty sure it was 6.1.something.

"EnTerr" wrote:
I also have serious doubts about usefulness of what you call "indexers" but looking forward to hear more

I can't think of a worthwhile use for them either, but the fact that it worked caused me a bit of headache tracking down what would have previously caused a crash.
I used "indexer" in the C# sense. What would you call them?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
EnTerr
Roku Guru

Re: Jan 13 update - Nice Debug console improvements - "count

"TheEndless" wrote:
"EnTerr" wrote:
... what you call "indexers" but looking forward to hear more

... I used "indexer" in the C# sense. What would you call them?

Umm... i would have said "[ ] operator", i suppose. Or "index accessor". A mouthful, i know. I did not know they named it "indexer" in C# world. But now that i heard it, i like it - it's shorter.

What confused me is that you used the term in particular way, implying only numerical indexing:
"TheEndless" wrote:
Count() is available for AAs now. Indexers are also available (i.e., AA[1])
But this is also an "indexer" - A["foo"]. The use of [ ] is, as we know, the AA's bread and butter.

The behavior you mention - if i got it right - was something like "ordinal indexing" (i.e. looking up value in AA by a number in some arbitrary order lineup). I wondering if there is some twisted way to get that by forcing particular interface call but come with nothing.

Side bar: this btw is different from allowing non-string keys in an AA. In some other languages one can do things like - example in Python:
>>> hash = {'a': 1, 1: True, False: [1], (1e9, 'foo'): {} }
>>> hash
{'a': 1, 1: True, (1000000000.0, 'foo'): {}, False: [1]}
>>> hash['a']
1
>>> hash[1]
True
>>> hash[1e9, 'foo']
{}
So it seems almost anything can be used as key there, also do mix&match. But not quite everything - only immutable objects are allowed: strings, numbers, tuples (but no lists), frozen-sets (but no sets or dictionaries). It can be useful but questionable due to complications (both as implementation and use).
0 Kudos

Re: Jan 13 update - Nice Debug console improvements - "count"?

The count represents the total number of items present in the container. It is displayed for roArray, roAssociativeArray, and roList.

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.