Notice how "w/div" and "w/element" don't appear at all in the JS: they're expanded away by the compiler. In case you're curious, the above code generates the following DOM structure:
<div>
<div foo="bar"></div>
</div>
---
Another nifty change I did was add in a couple optimizations for common cases. For instance, before, if you used this:
(def foo ()
(let a 50
(+ a 10)))
It would compile into this:
var foo = (function () {
return (function (a) {
return (a + 10);
})(50);
});
This is correct in all circumstances, but it's inefficient in the very common circumstance of a let inside a function. So I optimized it so it now compiles into this:
var foo = (function () {
var a = 50;
return (a + 10);
});
Aside from the superfluous parentheses, that code is just as fast as if you had manually wrote it! I also optimized `do` within functions: