[plt-scheme] 'eval' function seems to completely ignore scoping rules.

From: Noel Welsh (noelwelsh at gmail.com)
Date: Fri Jan 18 14:24:33 EST 2008

There are many good reasons not to do this.  If you want hygienic
macros, for example, you need to statically know all the bound
variables at any location.  If eval could access the lexical
environment then presumably it could introduce bindings and so break
hygiene.  Now Scheme does allow unhygienic macros, but in a more
structured manner that plays well with hygienic macros.  Almost all
uses of eval have been subsumed by other features of (PLT) Scheme,
making eval very rare in 'production' code.

On Jan 18, 2008 6:23 PM, Ran Gutin <manicmessiah at gmail.com> wrote:
> That's a bit, how should I say, peculiar?

> And if not that, is it possible to reference the current environment through
> a pointer similar to 'this' or 'self' in OO-land?

You could use a macro to capture the environment within a given scope.


Posted on the users mailing list.