is there a way to proxy a clojure dynamic var that is bound to some value outside of sci’s context to a dynamic var of the same name inside sci’s context?
I looked at the docs but I guess I’m not grokking something
okay great I’m JIT binding it now and it works 🙂 thanks borkdude!
There is no proxy var that follows the value of the host var, unfortunately. I've considered this but it's a bit complicated. Instead what you can do is the following: https://github.com/babashka/babashka/commit/d27efb137d54b7aa14ed4295f6e7caf272fc2aec
ok!
and then i still need to bind it using sci/bindings, correct?
it depends. in the commit I linked what happens is that in the exposed "shell" function, the host dynamic var gets "just in time" bound to the value of the SCI dynamic var. So if the user does in their program (binding [...]) the host function gets to see the right value
but it can work in the other direction too. an example of that is here: https://github.com/babashka/babashka/blob/c13500cddb974ce758689ab778ddaf8047dd72e6/src/babashka/impl/pprint.clj#L132-L137