Clojure 1.12.0-alpha2
Clojure 1.12.0-alpha2 is now available and we encourage you to try it and give us your feedback! Add libraries for interactive use There are many cases where it would be useful to add a library interactively or to patch a live system without restarting the JVM - speculative evaluation, adding a known dependency to your project, or adding a library to accomplish a specific task. Clojure 1.12.0-alpha2 provides new functions to add libraries interactively, without restarting the JVM or losing the state of your work: add-lib takes a lib that is not available on the classpath, and makes it available by downloading (if necessary) and adding to the classloader. Libs already on the classpath are not updated. If the coordinate is not provided, the newest Maven or git (if the library has an inferred git repo name) version or tag are used. add-libs is like add-lib , but resolves a set of new libraries and versions together. sync-deps calls add-libs with any libs present in deps.edn, but not yet present on the classpath. These new functions are intended only for interactive use at the repl - using a deps.edn etc is still the proper way to build and maintain your code. To this end, these functions all check that *repl* is bound to true (that flag is set automatically by clojure.main/repl ). In a clojure.main REPL, these new functions are automatically referred in the user namespace. In other repls, you may need to (require '[clojure.repl.deps :refer :all]) before use. Library

Clojure 1.12.0-alpha2 has been released, offering new features that enhance the interactive development experience. This version introduces functions to add libraries dynamically without restarting the JVM or losing the state of your work, making it easier to experiment with dependencies and libraries on the fly.
One of the key additions in Clojure 1.12.0-alpha2 is the `add-lib` function. This function allows users to add a library that is not currently on the classpath by downloading it (if necessary) and adding it to the classloader. Libraries already present on the classpath are not updated, ensuring that existing dependencies remain stable. If the library's coordinate is not provided, the newest Maven or git version (if an inferred git repo name exists) or tag is used. This feature is particularly useful for speculative evaluations, adding known dependencies to a project, or quickly testing a library for a specific task.
To handle multiple libraries at once, Clojure 1.12.0-alpha2 also introduces the `add-libs` function. It works similarly to `add-lib` but resolves a set of new libraries and versions together, ensuring compatibility and reducing the risk of conflicts.
Another useful function is `sync-deps`, which calls `add-libs` with any libraries present in the `deps.edn` file but not yet on the classpath. This function helps maintain a consistent and up-to-date classpath during development, allowing users to seamlessly integrate new dependencies without manual intervention.
It's important to note that these new functions are intended solely for interactive use at the REPL. While they provide a convenient way to experiment with libraries, the proper method for building and maintaining code remains the use of `deps.edn` and other build tools. To enforce this, the functions check that `*repl*` is bound to true, which is automatically set by `clojure.main/repl`. In a Clojure main REPL, these functions are automatically referred in the user namespace. For other REPLs, users may need to `(require '[clojure.repl.deps :refer :all])` before using them.
In addition to library management, Clojure 1.12.0-alpha2 also introduces an API for invoking tools out of process via the Clojure CLI. This feature allows developers to leverage useful tools during development without adding them as dependencies to their projects. The Clojure CLI supports tools with their own classpaths, ensuring that only necessary dependencies are included in the project.
Overall, Clojure 1.12.0-alpha2 enhances the interactive development experience by providing tools for dynamic library management and out-of-process tool invocation. These features empower developers to experiment, test, and iterate more efficiently, fostering a more agile and productive coding environment. The Clojure team encourages users to try out this new release and provide feedback to further improve the language.










