sub function scoping is a bit flakey... (eg. it's predicable as long as you know the rules.. var a = 1; function b() { println(a); } Will work, because a is in the global scope. function b() { var a = 1; function c() { println(a); } c(); } Will work as the compile knows that c is a local function, and gives c all the variables in b to the call. function b() { var a = 1; var c = function () { println(a); } c(); } Will not work - as at present, the compiler does not know that c is a local function It could be fixed by testing c on the call - to see if it was defined within this scope or above.. - if it is this scope then call context could be kludged...