Randomly Found Software: Nickel – An OCaml-Java-Bridge … And some thoughts on Java-Bridges in general.

There are two main reasons I can imagine why one would want to have an interface between Java and native code.

On the one hand, it can be used to extend Java, for special purposes, like jSDL and jOgl do as far as I know. There is nothing wrong with that, since at least some part of Java must be based on something like that. As long as any such library is really created portable, for all platforms that Java supports, and as long as this is really only done for special purposes which are time-critical and cannot be done in Java in an appropriate way, this is a good thing. On the other hand, why then not just writing in a language that can compile on all platforms, and link the libraries directly (as in C and C++ and in Common Lisp using the CFFI)?

On the other hand, to use some Library that is written in Java from some program that is not written in Java. Java has a lot of maintained libraries. Unfortunately, many of them cannot be compiled with gcj, and really rely on a JVM, mostly on Sun’s JVM. So if you want to write just a small piece of software, it is better to write it entirely in Java instead of using an interface. If you want to write a huge project, and dont want to use Java for it, then it should mostly be better to look for another library which is not bound to a JVM or implement one yourself first. So this possibility seems only suitable for quick and dirty hacks – for which I myself prefer an architecture that relies on communication through stdin/stdout, instead of some low-level-ffi.

Anyway. All this came in my mind when I read about Nickel on Freshmeat. Nickel is a bridge between OCaml and Java.

Well, I actually never used OCaml. I learned SML, and OCaml appears to be similar. And well, I like SML. I dont use it much, but its quite a pretty language. As far as I read, OCaml has a very modern and efficient garbage collector. However, as OCaml is high-level, it is more likely that there is a need to interface low-level-libraries from OCaml, than providing them for java, which will need running two runtimes at once.

Same – of course – for Common Lisp (which also has some libraries to do this).

Dont get me wrong: It is good to have such a library. There may be situations when this is needed, even though I cannot really imagine any. But if somebody really wants Java-Interoperability, then he may want to look for an implementation of his language for the Java-VM, which should exist for the most high-level languages, instead of using a native interface.


Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s

%d Bloggern gefällt das: