Clojure 1.12.0 released: interactive library management and enhanced Java interoperability
Clojure 1.12.0 has been released, featuring several enhancements to improve the developer experience, particularly during development time. A major addition is the interactive library management capability, which allows developers to add libraries without restarting the JVM or losing work state. This is achieved through new functions: add-lib, add-libs, and sync-deps. The add-lib function downloads and adds libraries to the classloader, add-libs resolves and adds multiple libraries and versions together, and sync-deps ensures any libraries specified in deps.edn are added. These functions are designed for use in the REPL during development, not for production code management.
The release also introduces invoke-tool, enabling developers to invoke tool functions out of process, thus avoiding the need to add tool dependencies directly to the project classpath. A new namespace, clojure.java.process, has been added to enhance process control, providing functions like start for advanced stream handling and exec for executing external processes.
Additionally, Clojure 1.12.0 improves handling of Java methods and functional interfaces. Qualified Java methods can now be used as ordinary functions, which reduces the need for verbose wrapping and automatically handles overloads via :param-tags. The release introduces syntax for referring to array classes with ComponentClass/#dimensions, supporting both type hints and primitive values. Java functional interfaces now benefit from implicit conversion from Clojure functions, simplifying interoperability. New functions like stream-seq!, stream-reduce!, stream-transduce!, and stream-into! have been added to facilitate working with streams, mirroring Clojure’s collection operations.
