Dynamic Binding

Tim Peters tim.one at comcast.net
Thu Apr 25 21:06:51 EDT 2002


[Tim]
> It seems this would have been a surprise to McCarthy <wink>:
>
>     http://www-formal.stanford.edu/jmc/history/lisp/node4.html
>
> See paragraph "d. Free variables".  When a user bumped into a function
> where the difference between dynamic and lexical scoping mattered, and
> lexical scoping was what they needed, "I must confess that I regarded
> this difficulty as just a bug".  The understanding of these issues was
> much muddier at the time.

[James J. Besemer]
> I disagree with your interpretation.

I take it you didn't follow the link and read the referenced paragraph.

> Rather he is saying that the implementation DID use dynamic "scoping,"
> that it worked just fine in most circumstances and that when people
> encountered a situation where "lexical scoping" would help McCarthy
> regarded their "difficulty" simply to be a bug.

I'll just finish the sentence I partially quoted:

     I must confess that I regarded this difficulty as just a bug and
     expressed confidence that Steve Russell would soon fix it.

Russell wrote the interpreter.  James Slagle wrote the code that was failing
due to dynamic scoping.  See the paper for more.  The differences between
lexical and dynamic scoping weren't clearly understood at the time.  Yes, it
used dynamic scoping, but the full implications of that implementation
choice weren't understood in advance, and some came as unwelcome surprises.

> I presume he means that the bug was in their code.  "It hurts when arg
> names conflict with your globals?  Don't DO that."

Reading the paper remains a recommended alternative to presumption <wink>.






More information about the Python-list mailing list