6.10 The FUNARG Problem

The concept of scope is only relevant in the presence of nonlocal references. Dynamic scoping is easier to implement than lexical scoping since it simply requires a downward search of the run-time call stack. Lexical scoping, by contrast, requires a search of the lexical graph of the program, which is typically tree structured. In either case, the activation record containing the declaration to which a nonlocal reference is bound will always be on the run-time stack, even though it may not be found in the record immediately beneath the record for the procedure containing the nonlocal reference. McCarthy’s first version of Lisp used dynamic scoping, though this was unintentional. This is an instance of a programming language ...

Get Programming Languages: Concepts and Implementation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.