Subject: Re: Idiot's guide to special variables take 2
From: Erik Naggum <erik@naggum.no>
Date: 16 Nov 2002 05:11:55 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3246412315069073@naggum.no>

* Nils Goesche
| And here is where I erred: There /is/ a global lexical environment; it is
| called the null lexical environment, and it is here where the binding is
| established.

  This is very confused.  The "null lexical environment" communicates to
  the alert reader that there are no lexically apparent bindings, not that
  any new bindings are established in it.  That `eval´ is evaluated in the
  null lexical environment means that it cannot access lexically apparent
  bindings, which `eval´ does not attempt to capture bindings when it
  receives a form.

  This is going off on a tangent, but assume you have a lexical environment
  with variables named `foo´ and `bar´, and wish to evaluate an expression
  that references these bindings via the obvious mechanism, the symbols
  `foo´ and `bar´, respectively -- how would you do that?  The association
  between symbol and variable is a compile-time-only notion for lexical
  bindings, and the lexical environment does not survive compilation.  If
  certain bindings have been captured by a closure, the association between
  symbol and variable is still lost and have to re-established explicitly.

  This is why, for instance, macro-expanding functions accept an environment
  and `eval´ does not, and more importantly, could not, and why environments
  are not first-class objects but rather compile-time-only notions that have
  to be constructed and used opaquely.  The ability for macros to access the
  lexical environment of the caller therefore must be of a very different
  nature than the accessability of and to the global environment via special
  variables and value slots in symbols.

-- 
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.