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: 
RokuKevin
Visitor

Re: dot operator behavior question

Thanks kbenson!

I love to learn new techniques from our dev community.

--Kevin
0 Kudos
RokuKevin
Visitor

Re: dot operator behavior question

Note that the technique of doing "dynamic dispatch" with the associative array syntax:

c["func"]()


will only work if the underlying object is an associative array. This is not true for objects created with the CreateObject() function. This technique will not work with those objects, and you are back to using Run() or eval()

--Kevin
0 Kudos
kbenson
Visitor

Re: dot operator behavior question

I suspected as much, but hadn't bothered to test. Luckily, that can be solved through a simple wrapper class that just dispatches to the component methods. Obviously there will by a little overhead (probably negligible unless there's LOTS of calls), but also the ability to put in sane defaults to the common use cases. In all, a fair trade-off in my opinion.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
kbenson
Visitor

Re: dot operator behavior question

"RokuKevin" wrote:
...we will continue to expand BrightScript's capabilities in the future. Including dynamic dispatch, closures, etc... could reasonably make the cut at some point.


I know it's a long shot, and there's other stuff to work on that's more important, but closures would be really useful right about now. Are there any scheduled plans for them in the future, or is it still a "it's possible" thing? Anonymous functions are great, but anonymous functions with closures are awesome.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
RokuKevin
Visitor

Re: dot operator behavior question

There are no immediate plans to provide closures in the language. I agree they would be useful.

--Kevin
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.