Re: Quick question: eval and read-from-string scoping



Jeremy Smith wrote:

And now I realise that eval is like a function, and local variables are not passed from function to function. So the question is revised: How do I pass variables to code executed by eval without declaring them as special?

This isn't specified in ANSI Common Lisp. Some CL implementations allow this as an extension. For example, clisp allows you to use first-class lexical environments in interpreted code - see http://clisp.cons.org/impnotes.html#eval-environ


Some other Lisp dialects provide this as well, for example OpenLisp, as do some Scheme implementations.

It's not specified in ANSI Common Lips because it prevents important optimizations. In many cases, you can find workarounds.


Pascal

--
My website: http://p-cos.net
Closer to MOP & ContextL:
http://common-lisp.net/project/closer/
.