Clojure 1.12.0-alpha6
Clojure 1.12.0-alpha6 is now available! Please read the release notes below. Clojure is a hosted language and fully embraces that host including the Java Virtual Machine, the JDK (Java Development Kit), and interop with Java APIs. Over the last decade, all of these have seen significant evolution and Java APIs are increasingly using recent Java features like streams, functional interfaces, and lambdas. Clojure 1.12 delivers significant enhancements to Java interop focusing on three main areas: Method values Functional interfaces Streams Method values Clojure programmers often want to use Java methods in higher-order functions (e.g. passing a Java method to map ). Until now, this has required programmers to manually wrap methods in functions. This is verbose, and might require manual hinting for overload disambiguation, or incur incidental reflection or boxing. With this release, programmers can now use Java qualified method symbols as ordinary functions in value contexts - the compiler will automatically generate the wrapping function. Method symbols signifying values must resolve to a single method at compile time, using the new qualified method symbols and/or :param-tags metadata as necessary. Qualified method symbols have value semantics when used in non-invocation positions: Classname/method - value is a Clojure function that invokes a static or instance method Classname/new - value is a Clojure function that invokes a constructor See: CLJ-2793 Uniform qualified method syntax - Class/method and Class/new Java members inherently exist in a class. For methods as values we need a way to explicitly specify the class of an instance method

Clojure 1.12.0-alpha6 has been released, bringing significant enhancements to Java interop, particularly focusing on three main areas: method values, functional interfaces, and streams. As a hosted language, Clojure fully embraces its Java host, including the Java Virtual Machine, the JDK, and interop with Java APIs. Over the past decade, these components have undergone significant evolution, with Java APIs increasingly utilizing recent features such as streams, functional interfaces, and lambdas.
One of the key improvements in Clojure 1.12 is the ability to use Java qualified method symbols as ordinary functions in value contexts. Previously, Clojure programmers had to manually wrap Java methods in functions, which was verbose and could require manual overload disambiguation or lead to incidental reflection and boxing. The new release automates this process, allowing developers to use Java methods directly in higher-order functions, such as passing a Java method to the map function.
To ensure that method symbols signifying values resolve to a single method at compile time, Clojure 1.12 introduces the use of qualified method symbols and :param-tags metadata. Qualified method symbols have value semantics when used in non-invocation positions. For example, "Classname/method" represents a Clojure function that invokes a static or instance method, while "Classname/new" invokes a constructor.
The uniform qualified method syntax, as described in CLJ-2793, allows for a consistent way to specify the class of an instance method. Previously, there was no possibility for inference, necessitating explicit specification. The "Classname/method" syntax now supports both static methods and instance methods, and "Classname/new" is used for constructors, in both invocation and value positions.
Class qualifiers can be either full class names or imported "short" class names, providing flexibility for developers. This enhancement simplifies the process of working with Java APIs in Clojure, making it more efficient and reducing the need for manual wrapping and disambiguation.
In summary, Clojure 1.12.0-alpha6 introduces substantial improvements to Java interop, particularly in handling method values, functional interfaces, and streams. By allowing direct use of Java qualified method symbols as functions, the release streamlines development and leverages the evolving features of the Java ecosystem, further solidifying Clojure's integration with Java.










