I've been trying for a while to solve this nREPL ticket and I'm out of ideas, so I decided to ask for a bit of help here.
Basically we need to be bind *print-namespace-maps* only if it's present or find some way to define if it's not present that doesn't mess up Clojure 1.9+.
Here are some of the things that don't work:
;; compilation error
(when (resolve '*print-namespace-maps*)
(set! *print-namespace-maps* (@bindings #'*print-namespace-maps*)))
;; shadows `clojure.core/*print-namespace-maps*` on 1.9, as the def gets executed always
(when-not (resolve 'clojure.core/*print-namespace-maps*)
(def ^:dynamic *print-namespace-maps*
"Define the var for clojure versions below 1.9"
nil))
Seems that dynamic vars can't be conditionally bound at all, which really sucks, but I guess there must be some way to do something like what we're aiming for.
Take a look at the linked issue for more details. Any help would be much appreciated!