Fork me on GitHub

the way I heard the story is that clojure's protocols were invented later, so anything from before that was not included as a protocol. Clojurescript, coming later, bootstrapped to protocols as quickly as possible so that everything else could be built upon them. Could just be an urban legend though 😄


that's pretty accurate, but even if protocols were invented before the clojure impl existed, the JVM is significantly different than the js runtime, meaning that a protocol-at-the-bottom impl in clojure-jvm would be significantly complex to bootstrapp and potentially much less performant


ah, that's an interesting detail :thinking_face: I will add it to future tellings to strangers in conference halls


I am seeing a situation with Oracle JDK 1.8 on a Mac (haven't tested others yet, but can if you think it matters) where I try to make a Java interop call from Clojure to a public constructor of a Java class on the classpath. It can find the class just fine, but I get the error message "No matching ctor found ...". The code printing that error message in the compiler is calling c.getConstructors() on the class c, and finding an empty list of constructors, which I also see in the REPL. Using clojure.reflect/type-reflect, the constructor is present.


Clojure 1.10.1 here


Any leads on finding out what is going on here, or trigger any memories of similar situations?


can you share example, stack trace, error msg, etc?


could be module accessibility


although usually that's a different message


dumb q @andy.fingerhut but are you sure the class contains the constructor you expect?


type matching on the args is probably the most likely reason not to find it


Andy said that class.getConstructors is returning []


so no reflector involved


I have debug print added to Java code just before error of my copy of Clojure 1.10.1, and it definitely shows 0 constructors returned by c.getConstructors() method call, before doing any filtering by parameter types. REPL session also shows 0 constructors from this call: (seq (.getConstructors


The weird thing is that this call does show the constructor showing up: (filter #(instance? clojure.reflect.Constructor %) (:members (clojure.reflect/type-reflect


shows that as a non-public constructor


ugh. Need more coffee, obviously. Thx


(fwiw I don't find it helpful to show non-public stuff in reflect/datafy)


Sorry for the noise. Just realizing now that clojure.reflect/type-reflect uses a different Java API call that also returns non-public constructors.