caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "forum@x9c.fr" <forum@x9c.fr>
To: OCaml List <caml-list@yquem.inria.fr>
Cc: forum@x9c.fr
Subject: Re: [Caml-list] question about the jvm backend
Date: Thu, 17 Jun 2010 21:29:14 +0200	[thread overview]
Message-ID: <7573F917-7D14-4238-9FD3-CF072DB90144@x9c.fr> (raw)
In-Reply-To: <AANLkTilrzXRxniITp8DOpnz6JyMEuO9zaWTjyDWWRH5t@mail.gmail.com>


Le 10 juin 2010 à 16:27, Martin DeMello a écrit :

> I have an OCaml implementation of an algorithm that I now want to use
> from clojure. As I see it, my options are:
> 
> 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
> 
> (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


      reply	other threads:[~2010-06-17 19:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10 14:27 Martin DeMello
2010-06-17 19:29 ` forum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7573F917-7D14-4238-9FD3-CF072DB90144@x9c.fr \
    --to=forum@x9c.fr \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).