在词法分析阶段定义的作用域。

目的:
  •  how a parser resolves variable names when functions are nested(函数嵌套时,词法分析器如何解析变量名)
规则:
  • Inner function 可以访问outer function 的变量


The word "lexical" refers to the fact that lexical scoping
  • uses the location where a variable is declared within the source code to determine where that variable is available. (通过声明位置来决定是否可用)
  • Nested functions have access to variables declared in their outer scope.


什么叫lexical environment,为什么封装的闭包可以创建一个新的lexical environment



lexical scope 词法作用域

2019-02-16 22:02:57 0 40
这里是评论

相关推荐