With Clojure 1.10 moving to require Java 8, are there plans to implement any of the new interfaces that arrived in that version of Java?
While not necessary to accomplish anything in Clojure, the interfaces in java.util.function
are sometimes necessary for interop. This requires clumsy wrapping with constructs like reify
.
For instance, clojure.lang.AFn
could be extended onto:
BiFunction
BiPredicate
Function
Predicate
With each implementing method calling the appropriate invoke
method. Clojure already uses Object
for most interop, so the generics would just use Object
everywhere.
Some of the other interfaces could also be considered, casting arguments and results, though the type overloading of functions like apply
would limit what could be accomplished there.