robert-hooke
robert-hooke copied to clipboard
Potential for StackOverflowError
If you add too many hooks to a fn, you will unsurprisingly encounter a java.lang.StackOverflowError
.
These calls appear between each fn invocation:
clojure.lang.AFn.applyToHelper (AFn.java:167)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:619)
robert.hooke$compose_hooks$fn__1381.doInvoke (hooke.clj:40)
clojure.lang.RestFn.invoke (RestFn.java:421)
I added 124 hooks to my fn :)
Obviously my own fault, but you may want to add a warning in docs.
Edit: or this could be an excuse to investigate a constant-space implementation with recur
.