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

Simone Martini simone.martini at unibo.it
Fri Jul 31 08:35:32 EDT 2020


Hi Norman

Is there another meaning of "lexical" that I don't know?
Or some interesting history?

there could be people here who knows more than me,
but I think the answer is “no” on both count.

First, I think that the expression "lexical scoping” is bad.
In presence of the (more linguistically correct) use of the
expression “lexical analysis”, it seems to imply, as you suggest,
that the two refer to the same notion of “lexical”,
which I think it is not the case.

Both in research literature, and teaching, we should use instead “static scoping”.

BTW, most PL books use “static”, not “lexical”. A very quick review:
de Bakker 1989;
Pratt: 1985;
Sethi: 1989: uses "lexical scope rule" (called also "static scope rule");
Appel book on compilers: 1998;
Tucker and Noonan: 2002;
Mitchell: 2003;
Ghezzi&Jazayeri 1998 “static binding (also called lexical scoping)”;
Scott 2000, who in footnote says “lexical scope is actually a better term than static scope, because scope rules based on nesting can be enforced at run time instead of compile time if desired”.

I looked for clues in early papers.
- Algol revised report, 1963
http://homepages.cs.ncl.ac.uk/cliff.jones/publications/OCRd/BBG63.pdf
It uses the notion of “scope”, but no use of the term “lexical”
(static scoping is implied by the “copy rule”,
which is used to explain the semantics of procedure calls).
- Weizenbaum, The funarg problem explained, 1968
http://www.softwarepreservation.org/projects/LISP/MIT/Weizenbaum-FUNARG_Problem_Explained-1968.pdf
no use of lexical
- Gries, Compiler construction for digital computers, 1971
no use of lexical
- Pascal report, 1972:
no use of lexical

Then, in
Moses, The function of FUNCTION in Lisp, 1970
https://dl.acm.org/doi/10.1145/1093410.1093411
we find:
“the free variable _a_ in the program segment below is easily accessed
because it is used lexically near the place where it is bound”
(and again another occurrence in the same way)

"Lexically near” is not incorrect (as it is instead “lexical scope”), but
it could have been here—and in this meaning (“closer in the text”) that the term “lexical” starts its march…

-s.
PS I would be interested in pinpointing the exact place where the expression “lexical scope” has been introduced.
---------------------------------------------------
Simone Martini

Dip. di Informatica - Scienza e Ingegneria
Universita' di Bologna
Mura Anteo Zamboni, 7        tel: +39 051 2094979
40127 Bologna BO             www.cs.unibo.it/~martini<http://www.cs.unibo.it/~martini>
Italy


On 30 Jul 2020, at 01:06, Norman Ramsey <nr at cs.tufts.edu<mailto:nr at cs.tufts.edu>> wrote:

[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

This question might be off topic, but I hope not---there is a lot of
knowledge here.  Why is "lexical scoping" called "lexical"?
I'm used to "lexical" referring to properties that describe how
concrete syntax is formed---what constitutes a comment, how characters
are grouped into tokens, and that sort of thing.   The "lexical scope"
used to give meaning to a closure seems more like a property of the
syntax, not of the lexis.

Is there another meaning of "lexical" that I don't know?
Or some interesting history?


Norman Ramsey





More information about the Types-list mailing list