Lexical Scoping

Why Trust Techopedia

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

Margaret Rouse
Senior Editor
Margaret Rouse
Senior Editor

Margaret 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 IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.