[plt-scheme] Re: plt-scheme type of language
On Dec 11, 2009, at 1:51 PM, Matthias Felleisen wrote:
> Consider an example such as dynamic scope for variables.
>
> I am pretty sure that very few people even discuss this idea
> in their courses. It was a historic mistake, and it got buried
> with Lisp. Even if you do throw in a lecture on dynamic scope
> when you cover lexical scope, it's just a waste of time --
> the disadvantages of dynamic scoping are so obvious that students
> just shrug their shoulders and move on. And yet, there are a
> few people left out in the world who every so often promote
> the idea.
If I were writing an interpreter for a new language, and had never thought about dynamic vs. static scope, I would come up with dynamic scope as a simple, elegant, easy implementation. (You have to admit it's easy: maintain a stack of (name,value) pairs, and every time the interpreter sees a variable reference, look down the stack until you match the name.)
Only later would I realize that it was a royal pain to program with :-)
Steve