From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 38E70BBAF for ; Thu, 17 Jun 2010 21:29:16 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjICAB8UGkxbeR7SkGdsb2JhbACfDwEBAQEJCQwHEQMfwhKFGgQ X-IronPort-AV: E=Sophos;i="4.53,433,1272837600"; d="scan'208";a="53352030" Received: from 27.mail-out.ovh.net ([91.121.30.210]) by mail2-smtp-roc.national.inria.fr with SMTP; 17 Jun 2010 21:29:15 +0200 Received: (qmail 6504 invoked by uid 503); 17 Jun 2010 19:32:05 -0000 Received: from b6.ovh.net (HELO mail192.ha.ovh.net) (213.186.33.56) by 27.mail-out.ovh.net with SMTP; 17 Jun 2010 19:32:05 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 17 Jun 2010 21:29:15 +0200 Received: from 81-64-226-86.rev.numericable.fr (HELO ?192.168.0.10?) (forum%x9c.fr@81.64.226.86) by ns0.ovh.net with SMTP; 17 Jun 2010 21:29:14 +0200 Subject: Re: [Caml-list] question about the jvm backend Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=iso-8859-1 From: "forum@x9c.fr" In-Reply-To: Date: Thu, 17 Jun 2010 21:29:14 +0200 Cc: forum@x9c.fr Content-Transfer-Encoding: quoted-printable Message-Id: <7573F917-7D14-4238-9FD3-CF072DB90144@x9c.fr> References: To: OCaml List X-Mailer: Apple Mail (2.1078) X-Ovh-Tracer-Id: 8613697238293545951 X-Ovh-Remote: 81.64.226.86 (81-64-226-86.rev.numericable.fr) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Spam: no; 0.00; ocaml:01 recompile:01 ocaml:01 callbacks:01 callbacks:01 runtime:01 ocamlc:01 ocamlopt:01 2.0:98 2.0:98 distrib:01 caml-list:01 algorithm:01 arbitrary:02 callback:02 Le 10 juin 2010 =E0 16:27, Martin DeMello a =E9crit : > I have an OCaml implementation of an algorithm that I now want to use > from clojure. As I see it, my options are: >=20 > 1. Port to clojure > 2. Port to scala (better support for pattern matching will make it > easier to port, also scala might be faster) > 3. Recompile the OCaml code against the JVM >=20 > (3) seems like the easiest choice, but from what I could gather from > the docs, there is not much support for generating a library that can > be consumed by a main program in another language. Is this going to > change in 2.0? Well, there are indeed two ways to call OCaml code from another JVM = language: - by callbacks; - by scripting. Callback from a JVM language work similarly to callback from C to either ocamlc- or ocamlopt-compiled code. This is described in the fourth chapter of [1], original callbacks being described by the chapter = [2]. However, beware that the representation of OCaml values is going to change in the upcoming 2.0 version of OCaml-Java. Scripting is based on the "javax.script" package introduced by JDK 1.6. It allows to execute arbitrary OCaml code, and can call OCaml compiled code. It is slower than callbacks, as the script code has to be compiled at runtime. Finally, here are some key points that may help you making up your mind: - performance in version 2.0 should stand between ocamlc and ocamlopt; - version 2.0 will be based on JDK 1.7; - hopefully an alpha version should be released during summer, with = the goal of having a stable version by the end of the year (current = target of JDK 1.7 release). Feel free to ask for further explanations if needed. Regards, Xavier Clerc [1] http://cadmium.x9c.fr/distrib/cadmium.pdf [2] http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html