> Moshe's explanation of "dynamic scope" is the definition I've seen in > every programming language text I've ever read. The essence of the > defintion, I believe, is that a free variable is resolved in the > environment created by the current procedure call stack. Ah. The term "free variable" makes sense here. > I think it muddles the discussion to use "dynamic scope" to describe > acquistion, though it is a dynamic feature. > > Python using dynamic scope for exceptions. If any exception is > raised, the exception handler that is triggered is determined by the > environment in which the procedure was called. Then I think this is also muddles the discussion, since the look for exception handlers has nothing to do with free variable lookup. > There are few languages that use dynamic scoping for normal name > resolution. Many early Lisp implementations did, but I think all the > modern ones use lexical scoping instead. It is hard to write modular > code using dynamic scope, because the behavior of a function with free > variables can not be determined by the module that defines it. Not > saying it isn't useful, just that it makes it much harder to reason > about how a particular modular or function works in isolation from the > rest of the system. I think Python 3000 ought to use totally static scoping. That will make it possible to do optimize code using built-in names! --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4