by hellofunk · 9y ago · 0 comments
If I run this:
(defn bar [x y]
(println x y))
(defn foo [v]
(if v (bar 12 42 79)))
(foo false)
The program prints nothing and Clojure reports no error.But when I run this:
(foo true)
Then Clojure reports an error: Exception in thread "main" clojure.lang.ArityException: Wrong number of args (3) passed to: user/bar, compiling:(.../test.clj:6:5) (defn foo [a b] :hi)
(defn bar [] (foo 1 2 3))
WARNING: Wrong number of args (3) passed to prepost.core/foo at line 25 src/cljs/prepost/core.cljs
WARNING: foo at line 24 is being replaced at line 48 src/cljs/prepost/core.cljs
It's a compile-time warning even when the app is not running, but ClojureScript goes through a different compilation step than JVM Clojure. Perhaps I was mistaken in the JVM case, or someone else can chime in.