全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Lexical scope, shadowing, dynamic scope?

又称: lexical scope · shadowing · dynamic scope

Definition 4.2 University Computer Science — Year 3 · 第 4 章 — Abstract Syntax and Semantic Analysis

Under lexical scope (or static scope), a declaration is visible in the region of the program text it belongs to: in Moor, from the declaration to the end of its block, inner blocks included. A declaration in an inner block shadows a declaration of the same name in an enclosing one: inside the inner block, the name refers to the inner declaration. Under dynamic scope, a name refers to the most recent declaration still active when the code runs, which depends on the chain of calls and not on the text.

在原文中阅读 →