This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-01
Channels
- # 100-days-of-code (2)
- # beginners (83)
- # calva (3)
- # cider (98)
- # clara (3)
- # clj-kondo (2)
- # clojure (84)
- # clojure-dev (59)
- # clojure-europe (11)
- # clojure-italy (22)
- # clojure-madison (4)
- # clojure-nl (3)
- # clojure-spec (24)
- # clojure-uk (80)
- # clojurescript (33)
- # clr (3)
- # datomic (59)
- # events (2)
- # fulcro (20)
- # interop (35)
- # jobs (6)
- # jobs-rus (1)
- # joker (3)
- # kaocha (2)
- # luminus (3)
- # off-topic (16)
- # other-languages (2)
- # pathom (17)
- # planck (2)
- # reagent (1)
- # shadow-cljs (1)
- # test-check (1)
- # tools-deps (49)
- # vim (16)
Currently writing code like this:
CompletableFuture
(-send-response [response exchange]
(.dispatch
^HttpServerExchange exchange
SameThreadExecutor/INSTANCE
^Runnable (^:once fn* []
(.thenApply
response
^Function (reify Function
(apply [_ response]
(-send-response response exchange)
(.endExchange ^HttpServerExchange exchange)))))))
We looked at it some for 1.10 and will probably take another swing at it in 1.11
I can’t search right now but there is a jira for it
that's the one, Ghadi's been working on it off and on
@ikitommi one thing we're thinking about is whether we can add the proper SAM interface to IFn automatically based on context. Not just for j.u.f.Function
the argument to setUncaughtExceptionHandler is a Thread$UncaughtExceptionHandler, which is a SAM
so would only work if the fn
is inline?
could you do it with a defn
if the user annotates it?
(.setUncaughtExceptionHandler (Thread/currentThread) (fn [t e] ....))
for that to execute without a ClassCastException, the third argument must be a Thread$UncaughtExceptionHandler,
(which would mean you need to propagate the calling context of setUncaughtExceptionHandler into the analysis of the fn)
Surely you wouldn’t need to do that if you just created a wrapper class at the invocation point?
again only with literals, maybe?
what triggers the emission of (reify Thread$UncaughtExceptionHandler (uncaughtException [t e] (my-fn t e))
?
just wanted to say that extending IFn to j.u.function.Function is only 1% of the problem
if it was easy, it would already be done :)