On Wed, Mar 13, 2013 at 2:06 PM, Marko Topolnik <marko.topol...@gmail.com>wrote:


> As far as I understand it, *set!* modifies the *thread-local* binding,
> just like the *binding* macro, but doesn't delimit a definite scope of
> validity for the binding. You can *set!* any dynamic var with the same
> semantics.
>

You can't just set! any dynamic var, you can only set! vars that are both
dynamic *and* have been bound again with the binding construct.

=> (def ^:dynamic a 2)
#'user/a
=> (set! a 3)
IllegalStateException Can't change/establish root binding of: a with set
clojure.lang.Var.set (Var.java:233)
=> (binding [a 1] (set! a 3))
3


This is why I'm puzzled about how things like (set! *unchecked-math* true)
are handled.  Clearly, in this special case you can use set! without first
calling binding.

-- 
-- 
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