Re-reading your reply, sounds like I might have explained what you already 
know. So to better answer your question:

Dynamic scoping and Java ThreadLocals gives you equal functionality, so I'd 
use them equally. This is because Clojure supports thread bound dynamic 
scope.

On Wednesday, 8 February 2017 14:39:59 UTC-8, Ernesto Garcia wrote:
>
> Hi Alex, thanks for your thorough response.
>
> It seems to me that Clojure vars are just not intended to be used as 
> thread-locals in general. They happen to use thread-local storage in order 
> to implement dynamic scoping, which is the original intent.
>
> That is why vars are either global (interned in a namespace), or confined 
> to a dynamic scope (via with-local-vars).
>
> If one needs thread-local storage, you use a Java ThreadLocal directly.
>

-- 
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/d/optout.

Reply via email to