.NET String addition doesn't work?

Oct 1, 2011 at 7:14 AM
Edited Oct 1, 2011 at 7:15 AM


I was playing around with this interpreter today and I wonder if I've found a quirk. If it is one, I'll file a bug report. Please tell what is up here - 

SpCL is a .NET class in the JINT_PRAC namespace. The GetStrProp() method in it returns a string which is initialized to "a".

I ran the following code:

var ht = new System.Collections.Hashtable();
ht.Add("x",new JINT_PRAC.SpCL());
ht.Add("y",new JINT_PRAC.SpCL());
return ht["x"].GetStrProp() + ht["y"].GetStrProp();

It returns NaN. On the other hand a simple

return "a" + "a";
returns the expected "aa".

Is this an ECMA 3.0 problem? What am I missing?


Oct 1, 2011 at 7:18 AM

Maybe I should add that I've also tried : 

return ht["x"].GetStrProp().ToString() + ht["y"].GetStrProp().ToString();