You're welcome.  Please go vote the issue 
up<http://dev.clojure.org/jira/browse/CLJ-1279>. 
:-)

On Wednesday, October 23, 2013 6:27:38 PM UTC-4, James Gatannah wrote:
>
> Oh, nice! I've been wondering what this error means for at least a month 
> now.
>
> Thanks,
> James
>
>
> On Thursday, October 17, 2013 1:14:21 PM UTC-5, Alex Coventry wrote:
>>
>> If you've ever had a confusing 
>> ArityException<http://clojure-log.n01se.net/date/2013-10-16.html#19:37> 
>> while 
>> working with macros, the reason may be that 
>> clojure.lang.Compiler.macroexpand1 rethrows any 
>> ArityExceptions<https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6475>it
>>  catches from a call to a macro, in order to reduce the number of 
>> arguments reported.  This messes up the stack, potentially destroying 
>> information about where the ArityException occurred if it did not occur 
>> from the call to the macro itself.  For instance:
>>
>> user> (do (defn inner [] (assoc)) (defmacro f [] (inner)) (f))
>> ArityException Wrong number of args (-2) passed to: core$assoc 
>>  clojure.lang.Compiler.macroexpand1 (Compiler.java:6488)
>> user> (use 'clojure.repl) (pst)
>> nil
>> ArityException Wrong number of args (-2) passed to: core$assoc
>> clojure.lang.Compiler.macroexpand1 (Compiler.java:6488)
>> clojure.lang.Compiler.macroexpand (Compiler.java:6544)
>> clojure.lang.Compiler.eval (Compiler.java:6618)
>> clojure.lang.Compiler.eval (Compiler.java:6624)
>> clojure.lang.Compiler.eval (Compiler.java:6597)
>> clojure.core/eval (core.clj:2864)
>> clojure.main/repl/read-eval-print--6596/fn--6599 (main.clj:260)
>> clojure.main/repl/read-eval-print--6596 (main.clj:260)
>> clojure.main/repl/fn--6605 (main.clj:278)
>> clojure.main/repl (main.clj:278)
>> clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn--1251 
>> (interruptible_eval.clj:56)
>> clojure.core/apply (core.clj:617)
>> nil
>> user> 
>>
>>
>> Note that the call to inner is not in the stack trace, and the number of 
>> arguments to it have been reduced by 2, leading to a nonsensical result in 
>> this case.
>>
>> The patch at http://dev.clojure.org/jira/browse/CLJ-1279 fixes this bug. 
>>  Might save you some time, if you're developing macros.
>>
>> Best regards,
>> Alex
>>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to