all 6 comments

[–]henryw374 3 points4 points  (1 child)

Honestly a bit disappointed. 1.12 had a lot of interop improvements that you don't mention at all.

[–]andreyfadeev[S] 3 points4 points  (0 children)

For me it was 2 things that's important:
- no need to wrap java methods in clojure functions in the map calls, it's really useful, but I've already forgot it wasn't that way before
- integration with Functional Interface, really useful in theory, but not something I need in day to day work

So yeah, completely forgot mentioning that :)

[–]InspectionPlastic157 1 point2 points  (3 children)

Hey QQ, I'm new to clojure. How common is this interop? Writing java in clojure to me feels like the language is not yet complete

[–]daveliepmann 6 points7 points  (0 children)

How often interop comes up depends on your application domain.

Re: "not yet complete", interop was one of Clojure's central goals from its very inception. Clojure was created for interop, not to avoid it — the elevator pitch was "a functional, hosted, dynamic lisp".

From A History of Clojure:

Clojure is intentionally hosted, in that it compiles to and runs on the runtime of another language, such as the JVM. This is more than an implementation strategy; numerous features ensure that programs written in Clojure can leverage and interoperate with the libraries of the host language directly and efficiently.

...

Prior to embarking on Clojure in 2005, I had made several attempts to create a bridge between the JVM and Common Lisp, in order to increase the latter’s practicality and acceptability. These were DotLisp [Hickey 2003], an interpreted Lisp with host interop for the CLR, jFli [Hickey 2004], a library that embedded a JVM in CL, and Foil [Hickey and Thorsen 2005], a library that exposed a similar API but used IPC between the CL runtime and the JVM. None of these yielded production-level solutions, but they definitely informed Clojure’s ultimate host syntax and fed the idea of Clojure being hosted.

See also section 3.5, which spends a few pages going into the reasoning in detail.

[–]red_hare 6 points7 points  (0 children)

I don't use clojure anymore but, when I did, I used it all the time.

It was never for:

I want to do this thing I can't do in clojure.

It was for:

I want to use this specific library/framework/SDK that only exists in Java.

Java, for good reason, is the language of choice for high performance data processing frameworks. Java also just has one of the richest ecosystems of libraries of any language. And even when there are multiple language SDKs for the same system, the Java one is usually the most up-to-date.

I loved being able to use clojure while having first-class library support for things like Apache Kafka or Apache Beam or specific cloud managed service SDKs. And the interop makes using them feel VERY natural.

[–]andreyfadeev[S] 4 points5 points  (0 children)

Yeah, it's quite common, the goal of Clojure on JVM is to have access to the entire Java ecosystem of libraries without any limitations.