2 ms·
I believe Clojure is less directly interoperable. For instance, a Scala class is a Java class. I believe creating a Java class in Clojure is something you have
by noelwelsh 12y ago
I believe Clojure is less directly interoperable. For instance, a Scala class is a Java class. I believe creating a Java class in Clojure is something you have to call into a library to do.
Update: reading the Clojure docs, the main issue I see is compiling Java code against Clojure code. Clojure has a number of constructs for calling Java code and creating Java objects, but it's not clear to me how you define an API in Clojure that Java code can then call.
- mateuszf 12y agoAll Clojure functions / values are instances of java classes (well maybe except java primitive types, but it's transparent).
- pron 12y agoActually, Clojure interoperates with Java much more cleanly, and easily than Scala. Every Clojure collection is a Java collection and vice versa. Every Clojure map is a Java map and vice-versa. Plus, because Clojure is less statically typed than Java, Java typing idioms don't clash with Clojure's.
- noelwelsh 12y ago> Plus, because Clojure is less statically typed than Java, Java typing idioms don't clash with Clojure's Well, you made me laugh. :) But the real deal is compiling stuff to JVM bytecode ahead of time, which Java code can then be compiled against. It's not clear to me that Clojure provides this, which is what I was getting at.
- pron 12y agoOf course Clojure does this. Clojure doesn't even have an interpreter.
- yogthos 12y agoHere's an example of exposing Clojure API to Java in one of my projects https://github.com/yogthos/selmer-java/blob/master/src/clj/selmer_java/core.clj https://github.com/yogthos/selmer-java/blob/master/src/clj/s...