Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

would you use clojure again?

Also - how do you deal with mixed source (eg clojure and java or whatever) in one project ?



Yes, definitely. I'm gradually scaling up to bigger and bigger projects with it. (I'm about to release a small open source disk snapshot backup utility that I've been writing with it for the last week or so)

As for dealing with mixed source: your or whatever is the key, to some extent.

Interop with Java itself (classes, class instances, static methods) is trivial, you can also easily subclass Java classes, typically to implement interfaces. The syntax for java calls is pretty straightforward, e.g:

   (. System/out (println "foo"))
There are a few variations on the above that are also permitted; of course, you've got a CL-style macro system at your disposal should the need for more syntactic sugar arise. I tend to just wrap frequently used Java calls in a function.

Because of the excellent Java integration, other JVM languages are at least as easy to work with as they are from Java. I've recently been playing with integrating Rhino with Clojure, which on the most basic level involves implementing Clojure's IFn interface for Rhino functions and Rhino's Callable interface for Clojure functions so you don't need to use the Java syntax. Syntactic integration of the data structures, etc. would of course also be nice, so it's not 100% trivial.

I can't really talk much about other JVM languages as I haven't used any others. I suspect Groovy is easy to work with as it's so close to Java itself.

One big side of the Clojure language that I haven't worked with at all is the concurrency support, which seems extremely solid.


I guess you have to avoid circular dependencies between the different languages, then its doable.


Not really; Java (the platform) can handle circular dependencies.




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

Search: