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

Semantic question about closures



I have a question about closures in CL. When a closure is made, with
some variable encapsulated in the closure, is that variable accessible
only with the exact function that was closed (thus somehow a copy of
the gut function must be made such that it internally references that
closure-cell directly rather than how the gut function in vacuuo would
reference that named variable), or is that variable accessible also
from any function called by the closure (thus we can implement a
closure by fluid-binding the closure-variable as we pass from the
closure into the gut function and copying the final value of the
fluid-binding back into the closure-cell when returning)? I.e. if
function A binds special X to some initial value, makes a closure of B
with free variable X referring to A's fluid-binding of X, then
lambda-binds X another level deep to a new value, then calls
B-closure, obviously references to X within B-closure will get the
first binding of X, but if B calls C which also refers to free
variable X does C get the closure-of-first-binding-of-X inherited from
closure-B or does C get the second-fluid-binding-of-X inherited
directly from A skipping over B?