Referencing environment and scope

2019-07-20 19:00发布

All,

In any programming language, is the type of referencing environment dependent on the scoping? i.e. a static scoped language would necessarily have static referencing environment?

Regards, darkie

1条回答
等我变得足够好
2楼-- · 2019-07-20 19:27

Yes. The referencing environment is the collection of variables which can be used. In a static scoped language, you can only reference the variables in the static reference environment.

A function in a static scoped language does have dynamic ancestors (i.e. its callers), but it can not reference any variables declared in that ancestor.

查看更多
登录 后发表回答