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. :disappointed_face:

-JT

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:


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.

If you add a ‘%’ character to the end of your variable name, you can be assured the variable is a statically typed Integer.

Example:


myInt% = x*(4000/5)  REM myInt% is an Integer.  x*(4000/5) is converted to an Integer 

–Kevin

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