clojurescript 2025-09-25

why

(identity 1 2 3)
throws, but
(apply identity [1 2 3])
return 1? what am i missing about apply?

Arity check is compile time, apply is a dynamic operation and there are no runtime arity warnings in cljs

👍 1
👉 2

it gets run into identity.call(identity, 1, 2, 3) in JavaScript, and Javascript doesn't care about extra argument for a function like function identity(x) { return x }

btw as identity is defined in clojure, it might be possible to check at compile time for the number of arguments, but not implemented.