Community
Participate
Working Groups
Build Identifier: 0.7.0.v201111032101 1) Open the attached H6.egl with VE, you can find that in the EDT it prints false, while in RBD is true. Reproducible: Always
Created attachment 206487 [details] The sample EGL file.
For your convenient, I copy the code in below. constraints dictionary = new Dictionary{ min = 100}; input string = "4"; if(input > constraints.min as int) syslib.writeStdout("false"); else syslib.writeStdout("true"); end
I agree that the behavior of EDT and RBD is different, but I think the behavior of EDT is right: because "input" is a String type, the below comparison is for String, not int: if(input > constraints.min as int) Both JSGen ahd JavaGen in EDT have the same behavior, so I think this is worked as designed. Below case is for int comparison: if(input as int > constraints.min as int) Brian, what do you think? Thanks.
I discussed this with Paul. When doing a conversion of one type to another, we always Widen one type to match if we can. If you look in EString.egl, there is a conversion from Int to String that is marked as 'widening': static function asString(value EInt in) returns (EString) {@Operation{"widen"}}; This means that the comparison is "4" > "100". This is different than RBD, but I spoke with Tim about this, and the widen is from int to String because a String to an int can throw an exception if the String does not contain a number. Finally, after discussing this with Paul, the comparison appears to be implemented as a char[]. I spoke with Tim about this as well, and he believes that the implementation should be a locale based sort of the two strings (e.g. Collator).
NOTE: We can discuss the string comparison changes, and decide if we want to make any changes in EDT .7, but the main point is that the widening from int to string is the expected behavior.
After thinking about this more, let's not change the string comparison implementation in .7.
The code is behaving properly. Not a bug.
Closing all bugs in the RESOLVED state with reason INVALID, WONTFIX, DUPLICATE, WORKSFORME, or NOT_ECLIPSE.