Subject: Re: Dead end in LISP implementation
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/02/20
Newsgroups: comp.lang.lisp
Message-ID: <6cjis0$150jt@fido.asd.sgi.com>

Wolfgang von Hansen <wvh@geodesy.inka.de> 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:

	ftp://ftp.inria.fr/INRIA/Projects/icsla/WWW/LiSP.html

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

-----
Rob Warnock, 7L-551		rpw3@sgi.com   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