[TYPES] what is "lexical" about "lexical scoping"?

Stefan Monnier monnier at iro.umontreal.ca
Sun Aug 2 23:34:14 EDT 2020


> 2. "of or relating to a lexicon or to lexicography"
>
> That is the meaning I would associate with the phrase "lexical
> scoping". As I understand lexical scoping, a scope is a dictionary or
> lexicon, basically a map from identifiers of the concrete syntax to
> binding sites of the abstract syntax. This dictionary is updated
> during parsing. Perhaps "lexical" refers to the fact that the meaning
> of the identifier is looked up in this (static) lexicon, as opposed to
> determined dynamically at runtime?

I don't really buy that explanation: the implementation of dynamic
scoping also uses a "dictionary" where variables are looked up.
The rules for which dictionary to use when is just a bit different from
those of static scoping, but the lookup of variables in a lexicon is
common to both scoping rules.


        Stefan




More information about the Types-list mailing list