Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Thursday, July 15, 2010

Combining Java, Clojure and JRuby

JRuby can access classes implemented in pure Java code. Clojure can generate a class file. Therefore it's straightforward for JRuby to access classes implemented in Clojure.

relationship

First I define a class with a method in plain Java.

MrJava.java:

  1. It gets better; you can use Clojure's persistent data structures from JRuby as well: http://github.com/technomancy/clojure-gem

    Using the STM is still not seamless since JRuby's Exception proxies get in the way of transaction retries, but with a little more work it could be done.

    ReplyDelete
  2. Thanks Phil for letting me know it!

    ReplyDelete

Followers