Friday 8 January 2016

Meaning of lexical scope in Lisp

Lexical scope is described with the following:

Lexical scope. Here references to the established entity can occur only within certain program portions that are lexically (that is, textually) contained within the establishing construct

(Guy Steele et al (1989), Common Lisp the Language, 2nd edition, Chapter 3, Scope and Extent)

I think a nicer description is that lexical scope is early binding. It just so happens that all language constructs (lambdalet) that can create a binding for a variable that can be in effect when a function is defined happen to contain the textual region of the program where the variable is used.

I understood this from

Joel Moses (1970), The Function of FUNCTION in LISP

No comments:

Post a Comment