renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-12-2010
10:45 PM
Dynamic typing bit me in the butt
My integer got turned into a float because I added x*(4000/5) to it. It wasn't a problem until I tried to convert it to a string with ToStr(). I think if floats had a ToStr() interface it wouldn't have been a problem at all. š
-JT
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
3 REPLIES 3
kbenson
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-12-2010
11:51 PM
Re: Dynamic typing bit me in the butt
I might have something useful on this front in a few days. I'm working on a sort of super box() object, that will support common methods for anything you hand it, and if I can pull it off, string interpolation (through an in-string sigil) to boot. It will be part of librokudev if I can get it to work well enough.
Something like:
superbox and string are examples, nothing set in stone yet... I'm considering using single character methods for brevity.
Something like:
v = x*(4000/5)
print superbox(v).string()
superbox and string are examples, nothing set in stone yet... I'm considering using single character methods for brevity.
-- GandK Labs
Check out Reversi! in the channel store!
Check out Reversi! in the channel store!

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-22-2010
02:37 PM
Re: Dynamic typing bit me in the butt
If you add a '%' character to the end of your variable name, you can be assured the variable is a statically typed Integer.
Example:
--Kevin
Example:
myInt% = x*(4000/5) REM myInt% is an Integer. x*(4000/5) is converted to an Integer
--Kevin
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-22-2010
03:15 PM
Re: Dynamic typing bit me in the butt
I admit it was a dumb mistake on my part. I have Int()'s all over the place, but I just missed that one. I really should use %'s on my integers, but I guess I'm just lazy. I just wanted to point it out to others that you have to be careful.
-JT
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.