jo_clojure icon indicating copy to clipboard operation
jo_clojure copied to clipboard

Function calls with wrong number of arguments don't throw errors

Open mateodif opened this issue 2 years ago • 2 comments

Describe the bug In Clojure, calling a function with more arguments that it takes throws an ArityException. This is not the behavior experienced.

To Reproduce In the REPL, try the following:

> (defn arity-test [n] (+ n n))
> (println (arity-test 1))
2
> (println (arity-test 1 1))
2

Expected behavior In a Clojure REPL, do the same as above:

user=> (defn arity-test [n] (+ n n))
#'user/arity-test
user=> (arity-test 1)
2
user=> (arity-test 1 1)
clojure.lang.ArityException: Wrong number of args (2) passed to: user/arity-test [at <repl>:3:1]
user=>

However, I know that this project doesn't try to stay 1:1 with Clojure's behavior, so I'm left wondering if this is expected behavior or not :)

mateodif avatar Dec 28 '23 02:12 mateodif

Its expected for the moment. No exceptions here. I'll leave this issue open though for now.

Zelex avatar Dec 31 '23 21:12 Zelex

I updated the code to print a warning when you call a function with wrong number of arguments. Should help fix this.

Zelex avatar Apr 17 '25 17:04 Zelex