Fork me on GitHub
#clojure-dev
<
2019-10-17
>
pyr16:10:57

Since Clojure now mandates Java8 as there been prior discussion around making functions implement the java.util.Function methods to make interop with Java APIs that make heavy use of it a bit more seamless?

pyr16:10:01

If not, is it a discussion worth having 🙂

ghadi16:10:56

have been thinking about various approaches @pyr

ghadi16:10:16

there is some discussion in this room if you can find the archives

ghadi16:10:13

one approach is to make IFn implement some of those things in j.u.f (which ones? why?)

ghadi16:10:53

another approach is to enhance host interop calls to be smarter and auto-add interfaces

pyr16:10:34

auto-add interfaces, you mean based on function arities?

ghadi16:10:17

do we want to have nice interop with all functional interfaces, including ones that don't live in java.util.function?

ThreadLocal.withInitial(() -> new Whatever());   // creates a Supplier

Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> doSomething());  // a Thread$UncaughtExceptionHandler

ghadi16:10:05

Java creates lambdas contextually

ghadi16:10:45

and they don't have to be in java.util.function -- any interface with one abstract method will do

ghadi16:10:46

"It's complicated"

🤯 4
ghadi16:10:26

right now, you can go pretty far with macros to make it nicer

ghadi16:10:47

😵 4
Alex Miller (Clojure team)17:10:34

although it is already on the list for 1.11 consideration