lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> > As I understand it, "lexical" scoping is a term used in opposition to
> > "dynamic" scoping, ....
>
> No, static scoping means that the variable binding to which every
> variable reference refers can be determined by a static analysis of
> the program.  Dynamic scoping is the opposite of static scoping.

This is the heart of the misunderstanding then. The trouble is that "lexical
scope" means different things to different people. For example, in the
Dragon Book (Aho, Sethi & Ullman, 1986), the authors write "A common rule,
called the lexical- or static-scope rule..." (p. 411). This is the
definition I was using.

Since C doesn't have nested function definitions, I don't really see how you
can tell it's not lexically-scoped in your sense, anyway: you simply can't
write functions that refer to outer (but not global) variables.

-- 
http://sc3d.org/rrt/ | Analogy is a midwife, identity a murderer