Refactoring global atom to dynamically bound one

Excellent thoughts; thank you. I certainly could replace it with a let, and that seems like the “right” thing to do, but it would involve passing that variable around all over the place to the 3 or 4 branches of the code that refer to it. The code is built so several disparate functions all look at the namespace-global variable and read it for list arrangement, change it for sorting reversal, and compare against it for some equality checks – all stuff that works fine for one subscriber, but fails when multiple instantiations are needed. The hope was that dynamic binding might allow the simplest refactor, all the code that thinks of it as a global variable requiring no changes and no extra arguments needing passing. However, it looks like writing something like an on-click hook to the DOM breaks out of the dynamically bound scope and is not to be. This was basically my question, with uncertainty as to how mounting things in the DOM plays with CLJS function scope. It sounds like an answer from the DOM is, “don’t try anything fancy.”