clojure-dev

2026-01-13T14:16:45.331119Z

Invoking an anonymous primitive function seems to not use the primitive interface.

(set! *unchecked-math* :warn-on-boxed)
(let [f (fn ^double [] 1.0)]
  (+ 1.0 (f)))
;; Boxed math warning
Is this expected behaviour?

πŸ‘€ 1
Alex Miller (Clojure team) 2026-01-13T14:21:37.818549Z

Don't know, put it on ask please

πŸ‘ 1
bronsa 2026-01-13T14:24:11.199809Z

it's at least very intentional in the compiler, invokePrim optimisations are only emitted for var callsites

2026-01-13T14:30:49.036279Z

The limitation to 4 arguments on primitive functions means it’s not always possible to use a defn instead.