I implemented constant folding in the new compiler - it's pretty aggressive and will try to use reflection to optimize any method calls using literals. This has the cool side effect that even non-operator method calls such as 97.toChar() will get folded into "a". There are a couple of methods which are never optimized: "equals", "compare", and "Str.intern".
Keep constant folding in mind when designing tests - for example verifyEq(4+2, 6) is going to get optimized into verifyEq(6, 6) - probably not what you want. I made a special exception in the compiler so that constant folding is never performed on "sysTest".
brian Tue 24 Oct 2006
I implemented constant folding in the new compiler - it's pretty aggressive and will try to use reflection to optimize any method calls using literals. This has the cool side effect that even non-operator method calls such as
97.toChar()
will get folded into "a". There are a couple of methods which are never optimized: "equals", "compare", and "Str.intern".Keep constant folding in mind when designing tests - for example verifyEq(4+2, 6) is going to get optimized into verifyEq(6, 6) - probably not what you want. I made a special exception in the compiler so that constant folding is never performed on "sysTest".