From: Malcolm Matalka <mmatalka@gmail.com>
To: Arlen Cox <arlencox@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Make OCaml library available to Java
Date: Tue, 02 Aug 2016 10:56:42 +0000 [thread overview]
Message-ID: <86a8gvjv6d.fsf@gmail.com> (raw)
In-Reply-To: <CAHEcMuHCEjGzhs_TqOphqMJ7F07mCLMYO2FyZSz-zXiwa_Gfxg@mail.gmail.com> (Arlen Cox's message of "Tue, 2 Aug 2016 00:02:19 -0400")
You could also make an executable written in Ocaml that communicates
over stdin/stdout.
Arlen Cox <arlencox@gmail.com> writes:
> Hi all,
>
> I'm trying to figure out what the best way is to make an OCaml library
> available to a Java program. I can think of several ways to do this
> each with pros and cons:
>
> 1. OCaml-Java: This is the most obvious solution that translates the
> OCaml code directly to Java.
> + Simple interface to OCaml code
> + Portable Java-compatible code
> + Can easily call back into Java
> - OCaml-Java is a bit buggy
> - Code runs slower
>
> 2. js_of_ocaml: Translate OCaml to JavaScript and then use the new
> "fast" JavaScript engine in Java 8 to execute the JS.
> + Portable Java-compatible code
> + Can call back into Java (albeit, less easily than OCaml-Java)
> - Not type safe interface
> - Possible massive slowdowns or at least unpredictable performance
>
> 3. JNI with C Library: Wrap OCaml code in a C library and then call
> into that with JNI
> + Native OCaml performance
> - Complex GC interaction
> - Not type safe
> - Not portable (need different .so for each platform)
> - No tools to help in doing this (CamlJava is both unsupported and
> seemingly unidirectional)
> - No easy call back into Java
>
> Does anyone have any experience with doing this or have any
> suggestions on what to do in this situation?
>
> Thanks,
> Arlen
next prev parent reply other threads:[~2016-08-02 10:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 4:02 Arlen Cox
2016-08-02 10:56 ` Malcolm Matalka [this message]
2016-08-02 11:51 ` Arlen Cox
2016-08-02 16:34 ` Gerd Stolpmann
2016-08-02 16:48 ` Arlen Cox
2016-08-02 17:21 ` Pippijn van Steenhoven
2016-08-02 17:34 ` Arlen Cox
2016-08-03 12:43 ` Hendrik Boom
2016-08-03 12:46 ` Jeremy Yallop
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=86a8gvjv6d.fsf@gmail.com \
--to=mmatalka@gmail.com \
--cc=arlencox@gmail.com \
--cc=caml-list@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