3 ms·
Clojure is a great language on its own, like many articles show. But it feels like a big chore when you are doing business apps. You are between these two world
by Scarbutt 8y ago
Clojure is a great language on its own, like many articles show. But it feels like a big chore when you are doing business apps. You are between these two worlds, debugging imperative java code/libs and debugging clojure functional code/libs at the same time.
- tombert 8y agoI have to respectfully disagree. I find that Clojure makes dealing with Java pretty straightforward, and in fact is (in some ways) a "nicer Java than Java", especially if you don't mind paying the cost of runtime reflection. For example, the way you call a method is by using the (.myMethod args) syntax. Imagine we have something like this: (defn myCoolFunction [myarg] (.myMethod myarg "some argument")) This effectively gives us a level of structured typing...I don't particularly care what myarg is, as long as it has myMethod defined. There are other features that make interop with Java pretty pleasant. The `doto` macro allows you to have a nice encapsulated system when you have to do a bunch of property setting methods. (doto (MyClass.) (.setSomething 1) (.setSomethingElse 2) (.setSomethingElse 3)) Or, for that matter, the ability to directly compose methods and functions together without intermediate variables with the threading macros (-> myObject (.myMethod 1) (.myOtherMethod 2) (some-regular-function 3) (.anotherMethod 4)) My point is not to be a salesman for Clojure (even though I love the language), but rather to point out that the interop with Java tends to work very well, at least in my experience.
- lgessler 8y agoIf you're using Clojure, you do end up using a lot of Java libraries, but that has more to do with how gigantic the Java library ecosystem is (indeed, this is one of the reasons behind the decision to host Clojure on the JVM) than how small the Clojure library ecosystem is (subjectively to me, it seems at least as big as the average for what you'd expect of a programming language of its size, and definitely higher in average quality).
- mping 8y agoMost of the time you use a wrapper that someone wrote and forget about it. If it's a itch you write your own. Curiously, lots of wrappers are 1-4 years old and still work out of the box, which is a contrast with some other packages from other ecosystems (ahem node/js)
- iLemming 8y agoHave you actually used Clojure? Or you deduced that purely from reading articles about it? Clojure tames Java and Javascript to the point that you don't even realize that you're working with them.