I think there's just an "in" missing. i.e. I think it should be:
Bindings created with binding can be assigned to, which provides a
means for nested contexts to communicate with code before it _in_ the call
stack.
It could be a little clearer as follows:
Bindings created with _the binding macro_ can be assigned to, which[...]
--
Michael Wood <esio...@gmail.com>
The word "before" is what seems out of place to me. The typically use
of binding that I've seen is for binding a different value to a Var
for the duration of the binding scope which includes calls that occur
*after* the binding keyword, but in its scope. For example, println
normally writes to stdout, but you can changes that for a limited
scope with binding.
(println "This goes to stdout.")
(binding [*out* (java.io.FileWriter. "my.log")]
(println "This goes to the log file.")
(foo "bar") ; If the function foo uses println, that output will
also go to the log file.
(flush))
(println "Now we're back to writing to stdout.")
--
R. Mark Volkmann
Object Computing, Inc.
I actually didn't think too hard about that before your e-mail :) but
I think "before" is right. Jason's example demonstrates what this
means:
user> (def x)
#'user/x
user> (defn foo [] (set! x 10))
#'user/foo
user> (binding [x 1] ; first binding form
[x (binding [x 2] ; second binding form
[x (do (foo) x)]) x])
[1 [2 10] 1]
The second binding form is "before" foo in the call stack, yet foo can
influence it by calling (set! x 10).
I'm not sure if doing this sort of thing is a good idea, though.
While reading the description again I noticed a grammatical error. I
believe it should be:
Bindings created with binding can be assigned to, which provides a
means for a nested context to communicate with code before it in the call
stack.
i.e. "a ... context ... before it" rather than "contexts ... before it"
--
Michael Wood <esio...@gmail.com>