Issue Overview:
So far, definite assignment analysis (useBeforeInit) has issues that make it impractical and it isn't completely reliable.
So, implementing add(a,b), minus(a,b), concat(a,b) and compareTo(a,b), and etc seems to be the only automated solution.
This can also benefit by fixing problems with primitive type coercion, which is different in VBScript and Javascript.
eg: 0 + "1" is 1 in VBScript
Performance and Work time:
Overhead should not be too much of an issue in modern browsers, and after using Closure Compiler (which can inline many of these calls with type analysis in Rhino).
Functions should be trivial, and only needs to check for typeof === "undefined", and replace with corresponding value. Undefined wrapper may not even be necessary.
This can also be used to fix issue #26
Issue Overview: So far, definite assignment analysis (useBeforeInit) has issues that make it impractical and it isn't completely reliable.
So, implementing add(a,b), minus(a,b), concat(a,b) and compareTo(a,b), and etc seems to be the only automated solution. This can also benefit by fixing problems with primitive type coercion, which is different in VBScript and Javascript. eg: 0 + "1" is 1 in VBScript
Performance and Work time: Overhead should not be too much of an issue in modern browsers, and after using Closure Compiler (which can inline many of these calls with type analysis in Rhino). Functions should be trivial, and only needs to check for typeof === "undefined", and replace with corresponding value. Undefined wrapper may not even be necessary. This can also be used to fix issue #26
VBScript Behavior: Undefined variable behavior in VBScript: undefined == 0 undefined == "" 10 + undefined == 10 "" + undefined == "" undefined - 10 == -10 undefined is nothing
Solution: Translate a + b to add(a,b) if a = b then to if(compareTo(a,b)) a & b to concat(a,b) Use typeof a === "undefined" to handle behavior.