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 440307EF29 for ; Wed, 16 Dec 2015 14:29:08 +0100 (CET) IronPort-PHdr: 9a23:ISQDChTdzE5Pa12dJ+6Ok8vti9psv+yvbD5Q0YIujvd0So/mwa65ZRSN2/xhgRfzUJnB7Loc0qyN4/6mAz1LvcnJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbvipduJMk4U23KUWvBbElaflU3prM4YgI9veO4a6yDihT92QdlQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGY2zRakzTKRZATI6KCh1oZSz7ViQBTeIs0MVT2FeqhdMEQyNuAn3WoX1qinSue902S3cNsrzG/R8fh+r6qMjbRbpjCYBOHYd8XrLwph7hadf5RagvABXwojOYYjTOuAoLY3HetZPbmpIWI53WCsJVoi8Zo1JCeUGZ7wA9KHyolIPqV21Agz6V7Cn8SNBmnKjhf5y6O8mCwyTmVV4R98= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=chan.ngo2203@gmail.com; spf=Pass smtp.mailfrom=chan.ngo2203@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f49.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of chan.ngo2203@gmail.com) identity=pra; client-ip=74.125.82.49; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="chan.ngo2203@gmail.com"; x-sender="chan.ngo2203@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of chan.ngo2203@gmail.com designates 74.125.82.49 as permitted sender) identity=mailfrom; client-ip=74.125.82.49; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="chan.ngo2203@gmail.com"; x-sender="chan.ngo2203@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wm0-f49.google.com) identity=helo; client-ip=74.125.82.49; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="chan.ngo2203@gmail.com"; x-sender="postmaster@mail-wm0-f49.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AHAQDKZXFWmzFSfUpehAxtv1YhhWwCgSc7EQEBAQEBAQEBEAEBAQEBBgsLCSEuQRIBgVmCBwEBAQMBEi4BGx4DAQsGBQQHDScHIQIRAQUBCxEGARIih3cBAwoIDp5KgTE+MY0ygnmIKAoZJw1Wg1QBAQEBAQEEAQEBAQEBAQEBAQESAQUOiFeCboJTgjWDHoEaBZZ1B4U5hheBeIFcSYZxjCmDZ4InNoEXESaCMCOBXnEBAYJKgkUBAQE X-IPAS-Result: A0AHAQDKZXFWmzFSfUpehAxtv1YhhWwCgSc7EQEBAQEBAQEBEAEBAQEBBgsLCSEuQRIBgVmCBwEBAQMBEi4BGx4DAQsGBQQHDScHIQIRAQUBCxEGARIih3cBAwoIDp5KgTE+MY0ygnmIKAoZJw1Wg1QBAQEBAQEEAQEBAQEBAQEBAQESAQUOiFeCboJTgjWDHoEaBZZ1B4U5hheBeIFcSYZxjCmDZ4InNoEXESaCMCOBXnEBAYJKgkUBAQE X-IronPort-AV: E=Sophos;i="5.20,437,1444687200"; d="scan'208,217";a="192463869" Received: from mail-wm0-f49.google.com ([74.125.82.49]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 16 Dec 2015 14:29:06 +0100 Received: by mail-wm0-f49.google.com with SMTP id p187so1215527wmp.0 for ; Wed, 16 Dec 2015 05:29:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:message-id:mime-version:subject:date:references :to:in-reply-to; bh=h+nq2Moy1hqExL5P21eKnitxoIKfIxNGTsXiCHmXD64=; b=m4tqXQjmsWVrpeIAIbHL5ZAY0uWTpCQUt17vmSgNLJ/iE7pPoyU0R7zIfzEbpqAQ3p 321VsS8l+OHu/ZYuZOdBBY9HoUB4RUletRVAeWNFTicKYlkcYlYgYV/Xo0rHsOSk76JL 9s3R6F+FUueIkzWDNKPcALu1nexxc+n38duz8olzWhopI/oHspneG1xVKliXmtdc0GCQ /H8WCea+AaviSBlohdkgtUhZWtdW9K5OgADEbtnv2cMN3tGBI02rRyNR1Eel6bL2Phhs vHmyHeYW3T/IkNxwsbJfwn8U2fWqb4oUHd0yFyJKlGwN3sn8D4tZQRUKOxdxTjTS481h 7nJA== X-Received: by 10.28.229.65 with SMTP id c62mr11030039wmh.25.1450272546809; Wed, 16 Dec 2015 05:29:06 -0800 (PST) Received: from cafehanoi.irisa.fr (cafehanoi.irisa.fr. [131.254.11.144]) by smtp.gmail.com with ESMTPSA id cl2sm6011249wjc.33.2015.12.16.05.29.05 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Dec 2015 05:29:05 -0800 (PST) From: Chan Ngo Content-Type: multipart/alternative; boundary="Apple-Mail=_00405CEB-D6C6-4D32-B58B-5CEB814BF546" Message-Id: <4D6A138A-AA9F-4DFB-85E8-38B44983EC11@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Date: Wed, 16 Dec 2015 14:29:14 +0100 References: <8D722630-1CB1-413B-9F90-1F975FA5B64B@gmail.com> To: Paul Pelzl , OCaml Mailing List In-Reply-To: X-Mailer: Apple Mail (2.3112) Subject: Re: [Caml-list] Invoking Java programs from an OCaml program --Apple-Mail=_00405CEB-D6C6-4D32-B58B-5CEB814BF546 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Dec 15, 2015, at 6:21 AM, Paul Pelzl wrote: >=20 > On Mon, Dec 14, 2015 at 9:25 AM, Chan Ngo > wrote: > An alternative, if you want to do as follows: > - Compile Java program to an executable (not jar file) > - Call this executable and get the return values from it >=20 > So you can think about Unix module in OCaml, you can use the standard I/O= to realize a communication channel between your OCaml code and the executa= ble Java. > https://ocaml.github.io/ocamlunix/ocamlunix.html >=20 >=20 > If the data to be exchanged is structurally complex, then this technique = becomes difficult; a cross-platform serialization library can be very helpf= ul for generating appropriate serialization code in multiple languages. As= one example, Cap'n Proto has bindings for both Java and OCaml: https://cap= nproto.org/otherlang.html Yes, I agree, in some cases, it will become difficult and we need a cross-p= latform serialization library. Your example is a good point. In addition, i= f you can control the source code of the Java side, you can modify the code= such that it can return the result as JSON object then the OCaml side can = get this object value to parse complex data structures. Best, --- Chan Ngo INRIA, (+33)02 99 84 72 84 chan.ngo@inria.fr http://people.rennes.inria.fr/Chan.Ngo --Apple-Mail=_00405CEB-D6C6-4D32-B58B-5CEB814BF546 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
=
On Dec 15, 2015, = at 6:21 AM, Paul Pelzl <= pelzlpj@gmail.com> wrote:

On Mon, Dec 14, 2015 at 9:25= AM, Chan Ngo <chan.ngo2203@gmail.com> wrote:
An alternative, if you want to do as follows:- Compile Java program to an executable (not jar file)
<= div class=3D"">- Call this executable and get the return values from it

So you can think abo= ut Unix module in OCaml, you can use the standard I/O to realize a communic= ation channel between your OCaml code and the executable Java.



Yes, I= agree, in some cases, it will become difficult and we need a cross-platfor= m serialization library. Your example is a good point. In addition, if you = can control the source code of the Java side, you can modify the code such = that it can return the result as JSON object then the OCaml side can get th= is object value to parse complex data structures.

=
Best,

---
Chan Ngo
INRIA,
(+33)02 99 84 72 84

<= /body>= --Apple-Mail=_00405CEB-D6C6-4D32-B58B-5CEB814BF546--