评论者:aralo
以下是在CLJS中模拟/显示的CLJ票据中存在的问题
`
(enable-console-print!)
(defn self-call-test
[n]
(prn "inner")
(when (pos? n)
(self-call-test (dec n))))
(let [orig self-call-test]
(set! self-call-test
(fn outer [n]
(pr "outer")
(orig n))))
(self-call-test 2)
(def self-call-test2
(fn self-call-test2
[n]
(prn "inner")
(when (pos? n)
(self-call-test2 (dec n)))))
(let [orig self-call-test2]
(set! self-call-test2
(fn outer [n]
(pr "outer")
(orig n))))
(self-call-test2 2)
`
无优化时的输出
`
"outer"
"inner"
"outer"
"inner"
"outer"
"inner"
"outer"
"inner"
"inner"
"inner"
`
因此:这似乎也会破坏当前的行为,但是,在高级优化中给出这个
"outer" "inner" "inner" "inner"
对于两者都有。鉴于这种情况,似乎不改变高级构建中的行为更好,以避免跟踪生产用户的生产错误 hard。即使这与CLJ行为略有不同。有什么看法?