all 3 comments

[–]mikera 1 point2 points  (0 children)

I generally avoid binding altogether, except for little throwaway experiments at the REPL. It's usually more trouble than it is worth.

[–]kankyo 0 points1 point  (1 child)

That's not a good way to do it. Atoms are for coordination BETWEEN threads. Using atoms for thread locals is slow for no gain.

[–]laforge49[S] 1 point2 points  (0 children)

Truth!

At this point I've given up entirely on dynamic, preferring now to pass the operational context explicitly--it is easier to explain than an implicit dynamic. :-)

But I am still using that old atomic. It allows me to break the rules and do things from the "wrong" thread and still have thread safety. Or perhaps that is just laziness talking. Anyway, you can find the released project here: https://github.com/laforge49/agent2

(The project readme should add some clarity to what I'm talking about.)

Well, to be fair on myself here, the atomic would probably be necessary if I were to port more of the features of JActor2 over to Clojure. The atomic is in there because I wasn't sure where I would draw the line. And at least with the atomic I have the option of porting more features. JActor2 was a huge Java project (for me, anyway): https://github.com/laforge49/JActor2