views:

382

answers:

2

I took a look at some new languages for JVM. Two of them are gathering much interest these days: Clojure and Scala. But in my humble opinion, both of them are not ideal. (Let's keep it a speculation, cause I don't want to damage myself discussing..)

What I actually see as a tricky move is MS's invention - F#. Simply moving the OCaml language to .NET platform yield somewhat awesome.

The question is: Did someone manage to write a full-featured OCaml compiler for the JVM? What would you say if that's a good idea?

+6  A: 

This page has links to various attempts to integrate Java with OCaml.

http://www.cocan.org/ocaml_and_java

F# is somewhat different from OCaml in aspects due to the desire to have it work with the .NET framework, so, much as Scala is a hybrid language, so is F#, as you can pick and choose how much FP you want and how much OOP you want, in either language.

Here is a post from someone trying to move from Java to OCaml which you may find interesting: http://groups.csail.mit.edu/haystack/blog/2009/10/04/java-ocaml-and-fsharp/

James Black
Thanks, James. I didn't know that F# doesn't copy OCaml.
Bubba88
They are very similar, and if you are careful your OCaml source should work in F#, but they extended F# for .NET.
James Black
just because i'm curious, in what cases the ocaml code doesn't work as F# ?
LB
Monomorphic types, Functors, Structural subtyping, Polymorphic variants, Recursive types, Recursive modules, Typesetting (the Format module), Macros (camlp4), Non-int numeric literals in patterns
nlucaroni
@LB - Here is a thread that dealt with your question: http://stackoverflow.com/questions/179492/f-and-ocaml
James Black
Specifically, the Cadmium project in the list on Cocan looks highly relevant to Bubba88's needs.
Michael E
There were different projects taking different approaches, one may work better, and there may be an approach that is more ideal that wasn't shared with us. I liked that list, I thought it was well-done.
James Black
+4  A: 

How about Cafesterol: http://cafesterol.x9c.fr/

Cafesterol is an extension of the Objective Caml compiler suite that generates Java bytecode. Cafesterol provides an ocamljava compiler that is the Java counterpart of ocamlc/ocamlopt compilers distributed with the Objective Caml standard distribution. Cafesterol, in its 1.3 version builds with the 3.11.1 version of Objective Caml. The produced Java classes need the 1.3 version of Cadmium to run and can be executed on any Java 1.6 virtual machine.

aneccodeal