clojure-dev

2025-04-24T13:32:08.295929Z

is there a technical reason why the function classes created by fn* don't track the number of arities they have?

oyakushev 2025-04-24T13:34:17.899669Z

Number of arities doesn't sound very useful. You probably rather want the list of different arity sizes that the function accepts. It is technically possible to encode that into AFns but likely wasn't needed at the time.

ghadi 2025-04-24T13:34:30.927769Z

what is the underlying pain that motivated asking this question?

oyakushev 2025-04-24T13:36:51.609499Z

For example, vararg functions do this with getRequiredArity: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RestFn.java#L16

2025-04-24T14:19:03.477319Z

the pain of curiosity

2025-04-24T14:19:25.021049Z

under which i have suffered my entire life

2025-04-24T14:21:18.626939Z

and yes, i meant a list of the different arity sizes

2025-04-24T14:25:17.955859Z

a question in #clojure about arityexception made me wonder how hard it would be to track the arities of a function on something other than metadata

2025-04-24T14:30:24.971489Z

the underlying pain is, arityexceptions are unhelpful. they are the bare minimum necessary to indicate there's a mismatch between provided and expected arguments