I understand that what they have implemented was a deliberate decision, but wouldn't actually be easier to simply to identify that a variable is new to a particular scope and generate a var statement at the top of the javaScript function definition?
Does the compiler have any notion of scope?
edit: oh right, you need nonlocal or := if you want to access the outer scope.