clojure-dev

seancorfield 2026-05-08T13:52:15.411199Z

I see we have some renewed interest in https://clojure.atlassian.net/browse/CLJ-2817 getting addressed (two Asks, 9 votes total). It has a patch but needs an updated patch to fix the merge order of metadata, per Ambrose. If someone creates and adds a new patch with that fix, could this be considered for 1.13?

Alex Miller (Clojure team) 2026-05-08T14:26:37.895189Z

Sure

👍🏻 1
seancorfield 2026-05-08T19:37:06.710129Z

@alexmiller Just a sanity check -- the following doesn't work (it's a reflective call) and we're not trying to fix it with CLJ-2817, right?

(defn ^String primfn-returns-string-1 [^long n]
  (str n))
whereas this currently doesn't work but we expect CLJ-2817 to fix it:
(defn primfn-returns-string-2 ^String [^long n]
  (str n))
I can't figure out an appropriate test to isolate the problem @ambrosebs highlighted in that ticket about the current patch (oh, and RT.meta(args) can be null so it can be the first arg to RT.conj() in that case).

2026-05-08T21:53:51.811739Z

Revisiting this I'm not sure it's an actual issue, just maybe something worth noting. The current patch seems like the natural precedence order.

2026-05-08T21:57:01.400099Z

IIRC I was pointing out that the form

(defn ^Foo f ^Bar [])
now chooses Bar instead of Foo at invocation sites.

2026-05-08T21:59:36.651939Z

Perhaps it's better described as a fix than a regression? I think the actual return type will be Bar at the primitive call site? Before it was incorrectly Foo.

2026-05-08T22:08:43.852719Z

No, I was wrong it doesn't seem to use Foo at all (reflection warning is on Object).

Clojure 1.12.4
user=> (set! *warn-on-reflection* true)
true
user=> (defn ^Integer foo ^String [^long n] (str n))
#'user/foo
user=> #(.length (foo 0))
Reflection warning, NO_SOURCE_PATH:1:2 - reference to field length on java.lang.Object can't be resolved.
#object[user$eval139$fn__140 0x997d532 "user$eval139$fn__140@997d532"]
So I don't think my concern was valid in the first place.

seancorfield 2026-05-08T22:35:58.330599Z

Okay, that makes me feel better about not being able to create a test that differentiated the two metadata sites 🙂

👌 1
oyakushev 2026-05-12T12:11:07.560659Z

I'd love to see this merged. I'm ready to tune the patch if it helps to fast-track it. But from what I gather, it is currently fine as it is.

seancorfield 2026-05-12T15:11:04.374029Z

@alexyakushev Did you vote on the Asks?

➕ 1