From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 73FF07FF37 for ; Tue, 2 Aug 2016 18:34:58 +0200 (CEST) IronPort-PHdr: 9a23:+je4nRw3lRHAP9zXCy+O+j09IxM/srCxBDY+r6Qd0ewfIJqq85mqBkHD//Il1AaPBtSDra0UwLSH+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwud7yzRd6Z0ZX//tvx0qWbWx9Piju5bOE6BzSNhiKViPMrh5B/IL060BrDrygAUe1XwWR1OQDbxE6ktY+YtaRu+CVIuv8n69UIEeCjJ/x5HvRkC2EPKWQ44oXAsgmLGQKV4nYaWWIGuhVNCgnBqhr9W8GinDH9s79S1TOWdfbqSrQsXD2k6e8/SRnmjw8IOiQ1tXrLjchoiatdplStqkoskMbvfIiJOa8mLevmdtQASD8EB54JWg== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.130; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.130; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.126.130; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BJAAChyqBXhoJ+49RdhBt8rQqMJIF9IIV9AoFAOBQBAQEBAQEBAREBAQEICwsJGS+CMgQBEwGCEwEBBAFVJAULCxguITYGEwkSh3wDDwwBCbEMb4pADYQUAQEBAQYCARYOhTKEQoEDgkOCCYVPBYgkkFs0gTwCiwyCNYlPBIVsiCuEBYN3HoJZgVlsAYgwAQEB X-IPAS-Result: A0BJAAChyqBXhoJ+49RdhBt8rQqMJIF9IIV9AoFAOBQBAQEBAQEBAREBAQEICwsJGS+CMgQBEwGCEwEBBAFVJAULCxguITYGEwkSh3wDDwwBCbEMb4pADYQUAQEBAQYCARYOhTKEQoEDgkOCCYVPBYgkkFs0gTwCiwyCNYlPBIVsiCuEBYN3HoJZgVlsAYgwAQEB X-IronPort-AV: E=Sophos;i="5.28,461,1464645600"; d="asc'?scan'208";a="228795464" Received: from mout.kundenserver.de ([212.227.126.130]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2016 18:34:57 +0200 Received: from office1.lan.sumadev.de ([178.4.29.42]) by mrelayeu.kundenserver.de (mreue005) with ESMTPSA (Nemesis) id 0LxryC-1b9ZaO2TIq-015Fay; Tue, 02 Aug 2016 18:34:56 +0200 Received: from [192.168.65.10] (unknown [192.168.65.10]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id D46F4DC05D; Tue, 2 Aug 2016 18:34:55 +0200 (CEST) Message-ID: <1470155691.9343.12.camel@e130.lan.sumadev.de> From: Gerd Stolpmann To: Arlen Cox Cc: caml-list@inria.fr Date: Tue, 02 Aug 2016 18:34:51 +0200 In-Reply-To: References: <86a8gvjv6d.fsf@gmail.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-lzDVS7gsSKTGBSzr4KW2" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-Provags-ID: V03:K0:z0c8ZRyomjnWDrSSaTI6tK+1mQyaVMjbwQr0KsqT73hNnfVLQ8u 8vBrbAAZqTaDrwxay5NDS4onJhTw94oJdIpHldVW1wi6u4V3HKyInsjdSFlFqApyfF6gw70 6qm0lWAl+a6Kbbxu93bNVFzY5CJVIHuaSiy9NEC7QMh32velGhZHN+voC5Lf/ilcDFKrzm7 JhtftPOVVmcH5VZsDtUHg== X-UI-Out-Filterresults: notjunk:1;V01:K0:tCQLDWOC1go=:bxPAY7bM1AGE1FAWLOmECR U0Nwu356RP2KUlS4UlpOv0PHalJM8NZcHSyAr9vmrIcm2k2qPC9R+qM/xreIVYBzDIeyF8XAf obNIKjqsfQ9Zt6zHJ31ipFGbFYhcZfSBvDtIZns8hQezdJLzio1FN4aYUDofrPWBLB68fwuVR QdA8r/bXPURVrW+JfRArzrKPELF3ODLymZaoRq78XJ9PKC48ofj9z6ACv1ERfR5eonuiQb4D/ nA2jzAXbNDbGXCjATZijjH/K0SMlBkS6NklU3jIbnDWmQm8BZJNVkOBA9Y59dBxCvmn2RUiA9 RbYfP9e69u/5Bw3QBQjHxJqCuwUw2NLYy3GLkQ0iGQWzY8EMiWGuUXjCFczWb8fBUVFKSDkst 5St+3et8bI4ImjXGgNaaLcM8JcpwcC/QU37anitzgkQ4kimUSoI21rf8jdJP0/09JucxBK62l Tphc3gtiK9DtbdFE50P5NAJavcaxXPbt01JQ3pebtWNiKuawu023Audt4SkE+U/BRH+/CBVqY hoLwwWKOULXud7qBjn5/sLvVYVCJFOYHdzSgnM9bGw5DarZ3aQECDI1VeK4IZOMORK7S9zlSi /FVUgpWK5n5gUBjeE9lBhQLH+JIYMzMS4Zy3XdRy8HXi4b+kOEHSByPPbt2f2RYy5+7/RVPoG crYquVaGDRA3MPbmtyJN1IYVFE3nUJMiySgvwws6Ef6FHNvNIxh0TkaCtWC1R/0PRsVc= Subject: Re: [Caml-list] Make OCaml library available to Java --=-lzDVS7gsSKTGBSzr4KW2 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Am Dienstag, den 02.08.2016, 07:51 -0400 schrieb Arlen Cox: > Thank you for your answers. I should be more clear on a couple of > things. My default method of communication is to use pipes or > sockets. However, my code is an abstract domain library. The > interface exposes large, recursively defined variants; exposes > first-class modules (though not functors); and is expected to be > relatively high performance. >=20 > For now I'll tinker with the js_of_ocaml option. It might be a pain > to wrap it properly, but I think it should be possible to make the > performance acceptable by replacing a few of the hotter internal > components with native Java code accessed via the Javascript api. >=20 > I am still open to other ideas, though. >=20 > Has anyone considered writing a source-to-source translator from OCaml to= Scala? Scala is fairly slow for symbolical code. Actually, I'd be more interested in a source-to-source translator from Scala to OCaml to get better speed... For a translation of OCaml to Scala you need to start with the typed source code (cmt files) because Scala requires way more typing hints than OCaml, and to get the omnipresent subtyping under control. Also, there is no direct counterpart of first-class modules, so you'd have to work around that. Gerd > Thanks, > Arlen >=20 > On Tue, Aug 2, 2016 at 6:56 AM, Malcolm Matalka wrot= e: > > You could also make an executable written in Ocaml that communicates > > over stdin/stdout. > > > > Arlen Cox 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 >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-lzDVS7gsSKTGBSzr4KW2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJXoMurAAoJEAaM4b9ZLB5T5ooIAIhYTa9MbOwCgoRrYmxTbGYD XGt9rpeR8aSHF2qGBDa6bETb3xchYUyjE0vSbjgyl4fVakYHHEpD2/oWAW2tX/g3 vDGtIyLLdk8dlkBIwSVdoP3NO76/TDDxvrnqxy7EwJsxsjy4/jd5PUtNEv2QZ7od QdKMZYLPyYdFlZCc9tPZwSZnH8W8RqupJVmXC1V6zRGgoiuohGHeuDMv0o+aQ2Rw sovXRIY2dDBWps9b44esA+2Pa/cfI6a4V6Q1AD3DEY2WXivqx2SBfhBUcHJWZ7fP aIY/xYCGs2JuTUGbbqOoUbH6CSyT+P36jGTXDEAaRI2KgsKwUgJSStdPUwiG6MA= =zBZv -----END PGP SIGNATURE----- --=-lzDVS7gsSKTGBSzr4KW2--