Wolfgang von Hansen <email@example.com> wrote:
| But then I suddenly discovered a major flaw in my design...
| "delayed evaluation"... until the program control reaches some
| deeper nested functions.
| Now, recursive functions are always(?) implemented by using a stack where
| all the variables are put on. Variables of inner scopes hide the variables...
Without reading your essay in fine detail (sorry!), it sounds like you're
having trouble with "dynamic" versus "lexical" scope. Modern Lisps such
as Common Lisp and Scheme use lexical scoping of lambda-bound variables,
and their approach to your "delayed evaluation" problem is that lambdas
are "closed" over their environments, that is, carry around their lexical
environment with them. This is (a little) more expensive at lambda creation
time, but (usually) cheaper at function call time (besides being closer
to the lambda calculus).
I *strongly* suggest reading a book such as "Lisp in Small Pieces", by
Christian Queinnec [Cambridge University Press] (originally in French,
as "Les Languages Lisp" [InterEditions]). See:
This will expose you to a great variety of interpreter (and compiler)
strategies and alternatives.
Another useful book for a Lisp implementor is "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