"RokuMarkn" wrote:
I certainly agree, it's not always easy to see when a variable contains a String or an roString. There is a sense in which what the doc says is true, Strings are converted to roStrings when necessary, but it's not always easy to predict when it's necessary. It's best to explicitly convert to roString if you need an object.
Well, when in doubt we can always check with `type()`, right? How come the example above, taken
literally from the RTFM does not work?! It should have returned "roString" and it didn't.
Something sinister seems to happen though:
BrightScript Debugger> s = "foo": ?type(s),s, : s.setString("bar"): ?type(s),s '#1
String foo String foo
BrightScript Debugger> s = "f"+"oo": ?type(s),s, : s.setString("bar"): ?type(s),s '#2
String foo String bar
BrightScript Debugger> s= ["foo"][0]: ?type(s),s, : s.setString("bar"): ?type(s),s '#3
roString foo roString foo
One of those things is not like the other. Actually none are like the other, this is utterly befuddling! First, we see that sometimes mutator setString() does not change String (#1, as expected) - and sometimes it does (#2, wha?). And second, it does not change roString, which it should (#3, military grade "wtf?")
I was thinking boxed values can be used - after theEndless example - for passing function params "by reference" but now don't know what to think, massaraksh.