clojure-dev 2026-07-18

[edited: the problem was a shadowed binding, that was exposed when I refactored part of the code -- there were essentially two functions with the same name, one global, one local, and one of them accepted 3 args and the other 2 args 😞 ] If I provide a protocol implementation via metadata, is there anything I should be aware of in terms of arity handling that is different to regular calls through the protocol? Code I had before bound (partial #'f arg1) to a local f1, then had (fn [this arg] (f1 this arg)) as the implementation in metadata, and that worked fine. However, linters complained that this was unnecessary wrapping so I changed the implementation to (partial #'f arg1) directly, avoiding the local binding, and this failed with "Wrong number of args (2) passed to" #'f ... #'f here takes 3 args, so (partial #'f arg1) should be okay with taking two args but something about what partial returns (which has multiple arities) doesn't sit well with protocols here?

✅ 2

I'm asking here rather than in #C03S1KBA2 because I want to understand more of the implementation details here behind why that small code change breaks things.

There is the this arg which the partial impl doesn't account for

I think I misread, but there shouldn't be an issue there

Is partial (the anonymous function partial returns) actually in the stacktrace for the error?

Because that is exactly the error you would get if #'f was used directly without partial, or if partial was call on #'f without the arg

I tried reproducing this but failed, do you have a code snippet that triggers this behaviour?

I haven't been able to create a repro case yet, outside of that complex work code.

Figured it out -- see edited note on original post.

that's so annoying, hate when i do that

I have now turned on :shadowed-var in clj-kondo to make sure I don't fall into that trap again 😄

🎉 1