There are no function definitions in this code. Note that in v8 the program
{ var foo = 1; print(foo); } print(foo);
prints 1 twice. So foo is defined as a global variable.
I think V8 has the correct semantics. There is nothing in the ECMAScript spec saying that block statements carry their own scope, as far as I can remember.
- Maxime