What is Lexical Scoping?
Lexical scoping defines the scope of a functionality of a particular variable using a method that enables the variable to be called from the block of code in which it was defined. It is only during the compilation phase that the scope is determined. A private variable is one that is compatible with this definition. This term is also known as static scoping.
Lexical scoping allows variables to be declared within a certain scope and is only accessible within this region. Lexical scoping allows for lexical locks, but the lack of locks still ensures that the scope of the function gives the opportunity to enter the function. However, the lack of closures leads to dynamic scoping.
Lexical scoping is standardized in all algorithmic languages (ALGOL) such as Ada, Pascal and Modula2. In addition, it is used in modern functional languages such as ML and Haskel.