[parenscript-devel] Feature proposal: Optimize away constant arithmetic

Vladimir Sedach vsedach at gmail.com
Sat Jun 16 03:24:48 UTC 2007


This is a feature I'm planning to add to ParenScript that involves
eager evaluation for arithmetic constants, so for example:

(js (+ foo.bar 0)) => "foo.bar;"
(js (+ foo.bar 1 -1)) => "foo.bar;"
(js (+ foo.bar 2 3)) => "foo.bar + 5;"

This would make the generated Javascript be a few bytes shorter, but
more importantly it seems that many Javascript implementations don't
do constant arithmetic optimizations themselves, so it would speed up
the generated Javascript as well.



More information about the parenscript-devel mailing list