This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: Bad news from the module/environment front
Telford Tendys <telford@eng.uts.edu.au> writes:
> It allows you to grab the stack frame for each closure
> and that becomes an opaque object called an environment. This can be
> put into a variable or whatever plus you can use it as an extra arg for
> eval to force the eval to occur inside the distant closure. In essence
> it is a way to open a peekhole into a closure and let that closure be
> used elsewhere.
You mean, like this? ;-)
guile> (define foo (let ((a 3)) (lambda () a)))
guile> (define env (procedure-environment foo))
guile> (local-eval '(set! a 4) env)
guile> (foo)
4
guile>
> The nice thing is that it also has a debugger that grabs the stack
> frames and allows you to walk through them, evaluate things at each
> stack level, inspect variables, whatever... all by using these peekholes
> into closures.
Guile has had the basics for these abilities built in for several
years. Unfortunately no-one (I was supposed to do it originally) has
had time to write the higher-level layer, but now maybe things are
under way (Chris Hanson).