| I wish there was a way to pass variables to functions "implicitly". As if by setting "global" variables, but without polluting the global scope. (= x 5)
(def some-fn (name)
(prn "Hello " name ", x = " x))
arc> (w/config (x 10)
(some-fn "There"))
Hello There, x = 10
After w/config exits, x is set back to 5. arc>(some-fn "Here")
Hello Here, x = 5
I could easily write a macro for that (in fact, I did write one). The problem is when we have multiple threads. I want w/config to only affect the current call stack. Call stacks running in other threads are by definition not part of the current call stack.I think this kind of thing is called Dynamic Scoping[0] [0] http://en.wikipedia.org/wiki/Scope_%28programming%29#Dynamic_scoping |