4 ms·
Thanks for the examples! There are some things that aren't as easy. And sometimes it's a better choice to drop into Java to provide a shim between the package
by grzm 6y ago
Thanks for the examples!
There are some things that aren't as easy. And sometimes it's a better choice to drop into Java to provide a shim between the package you're interacting with and Clojure to make the interop easier, or when performance matters.
Regarding hinting for defrecord fields and deftype/reify, do you have references where this has been a problem for you? It's not something I've run into, but that's just my experience.
As for java.util.function interfaces, I just did this within the past couple of weeks, which worked for my use case:
defn ^java.util.function.Function as-function [f]
(reify java.util.function.Function
(apply [this arg] (f arg))))
For SAM conversions in general, there's https://github.com/ajoberstar/ike.cljj https://github.com/ajoberstar/ike.cljj . I haven't used it myself, but perhaps the pattern used there would work in you.
It sounds like what you've worked on has been relatively performance sensitive, which can definitely a thing. So perhaps some of these interop suggestions won't work for you.
Again, thanks for taking the time to be more explicit about what you've found frustrating.