Chapter 9. Java and JVM Interoperability
Many languages provide their own purpose-built runtime; popular examples of this approach include Python (CPython), Ruby (MRI), and Java (the JVM).[270] In contrast, Clojure is fundamentally a hosted language, meaning that it targets an existing runtime, also the JVM.[271] This means that rather than reimplementing a variety of foundational facilities (e.g., garbage collection, just-in-time compilation, threading, graphics contexts, etc.) and libraries of all sorts (from basics like String handling to esoterica like cryptographic functions), Clojure simply reuses all of the work that’s been done around the JVM.
Aside from simply being an implementation time saver, targeting a mature host is advantageous for the Clojure programmer as well:
The JVM core facilities and ecosystem of libraries are backed by significant engineering organizations. This means that they are generally well-tested, widely used, and aggressively optimized, yielding performance characteristics typically required or desired by most practitioners.
Being on the JVM means that there are standard routes of interoperability. Programs written in one language can call on functionality provided by libraries written in other languages, all in the same runtime, with the Java interfaces and the Java object model being the lingua franca.
The Java and broader JVM communities are huge, guaranteeing the wide availability of libraries for every domain, an abundance of support materials, and ...
Get Clojure Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.