Hacker News new | past | comments | ask | show | jobs | submit login

I 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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: