clojure-dev 2026-09-04

Will proxy also get the default method support that gen-class now has?

(def p (proxy [java.util.function.Function] [] (apply [x] (inc x))))
(.apply p 1)                 ; => 2
(.apply (.andThen p p) 1)    ; => UnsupportedOperationException: andThen

Might be somewhat related, as in proxy and default method: https://clojure.atlassian.net/browse/CLJ-2617

👍 1
Alex Miller (Clojure team) 2026-09-04T14:31:40.601339Z

that's a good question, will take some more thought. Java proxies don't surface interface default methods, everything goes through the proxy. they added a way to write your own call-through in proxies with InvocationHandler.invokeDefault() in Java 16 (which we are now past in Clojure 1.13)

Alex Miller (Clojure team) 2026-09-04T14:33:13.017129Z

as with gen-class, proxy was created before default and static methods on interfaces existed, and needs to be re-examined

The example given was reify but you mentioned gen-class…

yeah sorry. reify is fine. gen-class is fine now too (in 1.12.6). I wonder if proxy could be fixed too and CLJ-2617 seems to be the relevant ticket for it. thanks.

fixing proxy might let me remove a gnarly custom byte-code generating thing in babashka. it's not urgent since this workaround has been in place since 2022 and it works fine.

Another question: is dropping nil-valued input entries in :excess intended, given that :all keeps them?

user=> (let [{:keys [a] :excess ex} {:a 1 :b 2 :z nil}] ex)
;;=> {:b 2}

👍 1