I'm trying to use dotrace function of clojure.tools.trace namespace.
(dotrace [my-function] (my-function 5))
But I got this error:
IllegalStateException Can't dynamically bind non-dynamic var: my-ns/my-function clojure.lang.Var.pushThreadBindings (Var.java:339)
What does it mean? why I'm getting it?
(I'm using Clojure 1.3)
I think you need to declare your function as being dynamically bound, e.g.
(def ^:dynamic my-function
(fn [x] .....))
The reason for that is because if you don't explicitly ask for a dynamic var, Clojure (1.3 upwards) will make it non-dynamic as a performance optimization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With