name_masked
name_masked

Reputation: 9793

Referencing environment and scope

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?

Upvotes: 2

Views: 16213

Answers (1)

Sjoerd
Sjoerd

Reputation: 75629

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.

Upvotes: 3

Related Questions