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

This is interesting, and in general Clojure interop with Java is really nice. For me the biggest pain point comes when you are working with a Java framework, where you generally have to extend Java classes (abstract classes, often), and that gets pretty unwieldy. In general, I think, Clojure often tries to be too dynamic for what you generally want in this case, or at least what I did. For programming Android or IntelliJ plugins (which is what I tried to do) I'd prefer a mechanism to write the code with Clojure but generate "normal" (i.e. non-dynamic) bytecode AOT, like Kawa does.


You can do that, with gen-class:

http://clojure.org/compilation

The result is a completely "normal" non-dynamic java class. There's still a dependency on clojure.jar though.


It's not exactly a "normal" class IIRC - I believe each method is actually a class and method calls from the gen-class'ed class are delegated to them. This is to maintain the ability to replace these methods dynamically but it would be nice to be able to state that I don't want that behaviour. gen-class is a little odd to use, too. Again, it works but is just a little funky compared to the rest of the interop.




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

Search: