This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-09
Channels
- # announcements (47)
- # asami (43)
- # babashka (37)
- # beginners (119)
- # bitcoin (1)
- # calva (5)
- # circleci (5)
- # clj-kondo (36)
- # cljs-dev (5)
- # cljsrn (1)
- # clojure (92)
- # clojure-australia (2)
- # clojure-bay-area (2)
- # clojure-europe (121)
- # clojure-italy (7)
- # clojure-japan (1)
- # clojure-nl (4)
- # clojure-serbia (2)
- # clojure-uk (66)
- # clojuredesign-podcast (2)
- # clojurescript (19)
- # conjure (2)
- # cursive (13)
- # data-oriented-programming (2)
- # datomic (53)
- # defnpodcast (7)
- # depstar (33)
- # events (1)
- # fulcro (21)
- # graalvm (47)
- # jobs (1)
- # kaocha (1)
- # lambdaisland (1)
- # luminus (2)
- # malli (14)
- # membrane (16)
- # off-topic (45)
- # polylith (2)
- # re-frame (11)
- # reitit (7)
- # releases (1)
- # reveal (15)
- # rewrite-clj (123)
- # shadow-cljs (7)
- # sql (21)
- # startup-in-a-month (3)
- # tools-deps (25)
- # vim (2)
Do you know any libraries that are written in Clojure but targeted / widely used for Java?
More of a platform, but interesting to see, thanks!
Yes… I feel like most Clojure libraries would be a bad fit for Java. Hard to imagine how an idiomatic Clojure library can be conveniently used from Java… Perhaps something about managed in-process concurrency, where it can utilize the Clojure concurrency primitives behind the scenes. Immutable data structures and dynamic data transformation (which Clojure is excellent at) are quite foreign to Java.
That’s the point I am wondering about. Currently building a lib that could also be beneficial for Java devs, and I’m wondering about the API or a thin shim layer.
Depends on the arguments though… would it take Objects? Passing in Clojure data structures from Java is a no-go as far as ease-of-use
Or a small wrapper object. In my experience, Java folks are cautious about stuff that they cannot inject 😅
I would not require objects, most operations use identifiers. Some dynamic data structures, that’s the tricky part. Would not like to expose Map<String, Object>
Perhaps check if https://clojuredocs.org/clojure.core/bean can be helpful
@U45T93RA6 Apache Storm is unfortunately moving from Cloure to Java 😞
If you want to expose the library to Java developers it would be helpful for them if you define interfaces, even in Java files (although you may be able to use protocols for that) for them to work against. Then you implement those interfaces however you like on your end (reify, deftype, defrecord) while leaving it open for others
I did an example of that here https://github.com/puredanger/clojure-from-java
@U0N9SJHCH #clara was developed by a clojure sub-team inside a java application Also, #storm was developed in clojure but it's main API was in java (now storm V2 was rewritten in java)
clojure does not provide all the mechanisms you would need to provide easy/comfortable/idiomatic access from java
@UK0810AQ2 That sounds like a good approach, thank you!
@U064X3EF3 Will definitely look into that!
@U2J4FRT2T thanks for the pointers to clara, was planning to look into it, anyways
@U3JH98J4R What don’t you see happening, adoption of a Clojure library in Java, or making it technically possible?
Sure, you’d need to wrap all of that (if it’s not dynamic data structures)
i guess it would matter a lot what library you are writing and where the bulk of the logic goes
but its definitely not the same situation as with scala or kotlin where you can mostly just write it like normal and interop is relatively straightforward
I just can't think of a good strawman library where writing it in clojure would be the right call