如果内嵌函数调用时的作用域就是它们定义时所处的词法作用域,那就很好理解了。
Nested functions are perfectly understandable when they are invoked in the same lexical scope in which they are defined.
内部类以及lambda表达式一个局限性是——它们只引用来自它们的词法作用域的最终(final)局部变量。
One limitation of inner classes - and lambda expressions too - is that they can only refer to final local variables from their lexical scope.
这段代码执行的结果会跟你所期望的遵循词法作用域规则的程序运行的完全一样:一个函数在它所被定义的作用域中执行。
The results of this code are exactly what you would expect from a strict application of the lexical scoping rule: a function is executed in the scope in which it was defined.
应用推荐