[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lexical equivalent of progv

> Date:   Fri, 5 Mar 1993 14:56:19 -0800
> From:   bha <@ada3.ca.boeing.com:bha@gumby.boeing.com>
> Is there an equivalent of progv for lexical variables?
> That is, I want a form that accepts a list of variable names, and
> a list of values and binds those values to *lexical* variables over
> the body of the form.  Progv does this but binds values to *dynamic*
> variables.

In short, no.

If first-class environments had made it into the language, then you
could build (or augment) an environment and then evaluate the body in
this environment.  (First-class environments are discussed on pages
207-214 of CLtL2, but they've since been removed from the language.)

Still, you're stuck evaluating the body -- it won't run compiled.  To
compile it you'd need to be able to declare that a variable will be
lexically bound (which you can't), so that the compiler does not
either break or warn and use a dynamic reference.

Not to mention that non-lexical bindings of lexical variables is
rather contradictory.