We're updating the issue view to help you get more done. 

better error message when calling macros with arity

Description

This ticket is a copy of but for ClojureScript.

If you invoke a macro supplying an incorrect number of arguments the arity exception includes the &env and &form special variables in the count (thus making it look like the argument count is 2 greater than that in the code the user wrote).

An example is (while) which indicates

1 clojure.lang.ExceptionInfo: Wrong number of args (2) passed to: core/while at line 1 <cljs repl> {:file "<cljs repl>", :line 1, :column 1, :tag :cljs/analysis-error}

while the same generates the following in Clojure:

1 ArityException Wrong number of args (0) passed to: core/while clojure.lang.Compiler.macroexpand1 (Compiler.java:6636)

A quick experiment shows that it is indeed possible to imitate the solution employed in Clojure (catch the ArityException and re-throw a new one with a decremented argument count). A more generalized approach may be needed to not use Java classes when in bootstrapped.

Environment

None

Status

Assignee

Unassigned

Reporter

Mike Fikes

Labels

Approval

None

Patch

Code

Affects versions

1.7.145

Priority

Minor