[Python-Dev] LOAD_NAME & classes

Tim Peters tim.one@comcast.net
Tue, 23 Apr 2002 02:15:34 -0400

[Greg Ewing]
>>    http://www-formal.stanford.edu/jmc/history/lisp/lisp.html

> From there:
>    The difficulty was that when an inner recursion occurred, the value
>    of  car[x] wanted was the outer value, but the inner value was
>    actually used. In modern terminology, lexical scoping was wanted,
>    and dynamic scoping was obtained.
>    ...
>    I must confess that I regarded this difficulty as just a bug and
>    expressed confidence that Steve Russell would soon fix it.

> So it seems I was more or less right -- the semantics they
> wanted was lexical scoping, effectively, even if they didn't
> explicitly think about it.

They didn't even have names for it, Greg -- note the "in modern terminology"
there.  This is McCarthy reflecting on things that happened more than 20
years before he wrote the paper.  It was so muddy at the time that this
paper was reduced to

    Unfortunately, time did not permit writing an appendix giving the
    history of the problem, and the interested reader is referred to
    (Moses 1970) as a place to start. (David Park tells me that Patrick
    Fischer also had a hand in developing the FUNARG device).

Part of the problem is that the Lisp interpreter was written in Lisp, and
contrary to hopes it didn't fully specify the semantics:  it turned out that
what the Lisp implementation just happened to do for a thing sometimes
reflected directly in how the Lisp interpreter emulated that thing, and so
studying the interpreter code sheds no light on intent in such cases -- it's
a kind of "self-fulfilling algorithm" then.  "Metacircular interpreters"
fell out of favor for specifying language semantics as a result.  Modern
attempts to rehabilitate the idea are still stumbling over how to nail the
intended scoping semantics; see, e.g. (skip to Conclusions):