我已经尝试了一段时间来解决这个nREPL问题,但是我已经没有思路了,所以我决定在这里寻求一些帮助。
基本上,我们只需要绑定
以下是一些行不通的方法:
基本上,我们只需要绑定
*print-namespace-maps*
,如果它存在的话,或者找到一些定义它不存在的方式,而不会弄乱Clojure 1.9+。以下是一些行不通的方法:
;; 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))
似乎动态变量无法有条件地绑定,这非常糟糕,但我想一定有某种方法可以实现我们的目标。
有关更多详细信息,请参阅链接的问题。非常感谢任何帮助!
def
是编译器的 Java 部分。似乎存在读取或编译时的副作用,但我一开始没能发现它。 - Svantedef
作为Clojure的少数特殊形式之一进行调用。 - Taylor Wood