Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by
closed by

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.

1 Answer

+1 vote
by

There are several other ask clojure questions and jiras about this. We have spent a lot of time looking at options for this but have not yet decided on what we want to do (and we're not planning on doing so in the 1.11 timeframe).

by
I know it had been discussed prior to 1.10, when it couldn't happen due to Java 6 support. Unfortunately, I couldn't think of the right search terms for it on Ask Clojure, so figured I could ask directly.

I wasn't thinking of 1.11. Those features are mostly decided upon already, aren't they?
...