when a `fw` or `fnk` ref itself, `StackOverflowError` occurred.
Closed this issue · 1 comments
SnaiLiu commented
(def fm (fun-map {:a 1
:b 2
:sum (fw {:keys [a b sum]}
(+ a b sum))}))
(:sum fm)
;; => StackOverflowError java.lang.ClassLoader.findLoadedClass (ClassLoader.java:1273)
(def fm (fun-map {:a 1
:b 2
:sum (fnk [a b sum]
(+ a b sum))}))
(:sum fm)
;; => StackOverflowError clojure.lang.PersistentArrayMap.assoc (PersistentArrayMap.java:192)
As showed above,the FunctionWrapper of :sum
ref to itself。
robertluo commented
fun-map does not check cyclic dependency, so it is the user's responsibility to make sure not referring that.