I'm still a bit confused on the use of set!

I would like to define a configuration variable that is easy to change,
but which is not critical to my infrastructure; it's will set some
default behaviours.

Now, I can do things like

(binding [*warn-on-reflection* true]
      (do-some-function))

and it does the right thing. Similarly, I can do 

(def ^{:dynamic true} *my-test* false)
(binding [*my-test* true]
     (do-some-function))

and this all works. 

However, while I can do

(set! *warn-on-reflection* true)

I cannot do

(set! *my-test* true)

because I cannot change the root binding. What I confused about is how
does this work with *warn-on-reflection*? Where is the root binding? And
how come I am not trying to set it also? Can I get similar behaviour for
one of my vars? Or do I need to do something like:

(def *my-test* (atom true))
(reset! *my-test false)

but then I loose my dynamic binding? 

Phil

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to