Lexical Scoping

What Does Lexical Scoping Mean?

Lexical scoping is setting the scope of a functionality of a certain variable using a method, which facilitates calling the variable from the code block in which it was defined. It is only during the compilation phase in which the scope is determined. A private variable is a variable declared in a manner compatible with this definition.

Advertisements

This term is also known as static scoping.

Techopedia Explains Lexical Scoping

Lexical scoping allows variables to be declared within a specific scope and it is only accessible within that region. Lexical scoping allows for lexical closures, but the absence of closures still ensures that the scope allows the function to be re-entrant. However, the absence of closures gives rise to dynamic scoping.

Lexical scoping is standardized in all algorithmic languages (ALGOL), such as Ada, Pascal, and Modula2. Additionally, it is used in modern functional languages like ML and Haskel.

Advertisements

Related Terms

Latest API Management Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…