This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Dynamic scoping
- To: guile@cygnus.com
- Subject: Dynamic scoping
- From: David Lutterkort <lutter@cise.ufl.edu>
- Date: 23 Jun 1999 15:30:53 -0400
With Jim Blandy's environment proposal that Jost is implementing it looks
like it would be almost possible to implement some kind of dynamic
scopes. What I am interested in is the following scenario: I want to write
one function that constructs and returns an environment which then can be
passed to other functions so they can use that when evaluating some
expressions, like
(define (make-stuff) (let ((env (make-finite-environment)) ... env)))
(define (use-stuff stuff-env . other-args)
...
(with-environment stuff-env
... access things by first looking into stuff-env and then
into the surrounding lexical scope ...))
The only thing that's missing in the current environment implementation is
a with-environment macro. Could make-eval-environment be used for this ?
Would something like
(defmacro with-environment (env . body)
`(eval (begin ,@body) (make-eval-environment ,env (the-environment))))
do the trick or is there a better / more elegant / no solution to this
problem ?
Thanx,
David