Comment made by: aralo
So the issue that the CLJ ticket has is emulated/shown below in CLJS:
`
(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)
`
Output in with no optimizations:
`
"outer"
"inner"
"outer"
"inner"
"outer"
"inner"
"outer"
"inner"
"inner"
"inner"
`
So: It does seem this would also break the current behaviour, HOWEVER, the above with advance optimizations gives this:
"outer"
"inner"
"inner"
"inner"
for both. Given this, it seem better to not change behavior during advanced builds to avoid hard to track down production bugs for the users. Even if this is a slight deviation from CLJ behavior. Thoughts?