Wolfgang von Hansen <email@example.com> wrote:
| > sounds like you're having trouble with "dynamic" versus "lexical" scope.
| Thanks for the answer! Though I'm not sure if I really unterstood "lexical
| scoping", it seems to be rather difficult to implement.
Lexical scoping per se is actually easy, it what most of the non-Lispy
languages do, too (e.g., Pascal, and in the degenerate case, C & C++).
Allowing procedure definitions inside procedures (which C *doesn't*)
is a bit harder; you need what Pascal calls a "display". And then providing
"lexical closures with dynamic extent" (Scheme or Common Lisp lambdas)
is harder still.
You're really going to need to read up at least a little bit on lexically-
scoped Lisps (e.g., Common Lisp or Scheme). Again I would suggest perhaps
"Essentials of Programming Languages" by Friedman, Wand, and Haynes.
Rob Warnock, 7L-551 firstname.lastname@example.org http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673 [New area code!]
2011 N. Shoreline Blvd. FAX: 650-933-4392
Mountain View, CA 94043 PP-ASEL-IA