hello everyone
I have a problem about binding function in clojure1.8.
when I changed position of function which call a bound function I got
different result.
If I define test4 (call test1 within it) before test1, binding would not
work
(declare test1)
(defn test2 [](prn "test2"))
(defn test4 [] (test1))
(defn ^:dynamic test1 [] (prn "dynamic test1"))
(defn testB []
(binding [test1 test2]
(test1)
(test4)
))
when I call (testB) result is
"test2"
"dynamic test1"
But if I change postion of (defn test4 xxx) and (defn ^:dynamic test1 xxxx),
binding will work well.
(declare test1)
(defn test2 [](prn "test2"))
(defn ^:dynamic test1 [] (prn "dynamic test1"))
(defn test4 [] (test1))
(defn testB []
(binding [test1 test2]
(test1)
(test4)
))
result is
"test2"
"test2"
Any way, with-bindings is the same as binding, but why ?
========
any help would be appreciated
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.