[closer-devel] Dynamic environment capture
szergling
senatorzergling at gmail.com
Sun Mar 22 00:51:56 UTC 2009
Hi Pascal,
I have a quick question, or perhaps a bug report on the new dynamic
environments and their capture. Is 'nested' capture supported?
(defdynamic x nil)
X
(defparameter *y*
(dlet ((x 1))
(capture-dynamic-environment)))
*Y*
(with-dynamic-environment (*y*)
(dynamic x))
1
(defparameter *x*
(with-dynamic-environment (*y*)
(capture-dynamic-environment)))
*X*
(with-dynamic-environment (*x*)
(dynamic x))
NIL
Inspecting *x* shows that its dynamic-winds slot is nil.
I would guess that nested capture is the intended behaviour, from
reading the source. Capture would go through *dynamic-wind-stack*
collecting environments. However, call-with-dynamic-environment
doesn't seem to re-establish *dynamic-wind-stack*. How do I capture
all of *y* in *x* as well? This way, there's a chain of environments
to fallback on.
Thanks in advance for your help.
Theam Yong Chew
Aside:
Should defdynamic be required before we can use dlet?
(dlet ((x 1)) (...))
Should be pretty obvious that x is dynamic. Especially when we access
it via (dynamic x).
More information about the closer-devel
mailing list