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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 10DA97FCCB for ; Thu, 30 Apr 2015 00:03:26 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of helmut.brandl@gmx.net) identity=pra; client-ip=212.227.15.18; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="helmut.brandl@gmx.net"; x-sender="helmut.brandl@gmx.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of helmut.brandl@gmx.net designates 212.227.15.18 as permitted sender) identity=mailfrom; client-ip=212.227.15.18; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="helmut.brandl@gmx.net"; x-sender="helmut.brandl@gmx.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.gmx.net) identity=helo; client-ip=212.227.15.18; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="helmut.brandl@gmx.net"; x-sender="postmaster@mout.gmx.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0C/AADCU0FVnBIP49Rcg1+DdsJmCYFLhgwCgUU4FAEBAQEBAQERAQEBAQEGDQkJIS6EIQEBBCMECwEFNAoCEQsYAgIFFgsCAgkDAgECAUUTCAEBiBIBFgKoP4tqjWsBhXYBAQgBAQEBHoEhiheFDBaCUoFFBYtrg1uGLY17hHOJSYQ1gxYBAQE X-IPAS-Result: A0C/AADCU0FVnBIP49Rcg1+DdsJmCYFLhgwCgUU4FAEBAQEBAQERAQEBAQEGDQkJIS6EIQEBBCMECwEFNAoCEQsYAgIFFgsCAgkDAgECAUUTCAEBiBIBFgKoP4tqjWsBhXYBAQgBAQEBHoEhiheFDBaCUoFFBYtrg1uGLY17hHOJSYQ1gxYBAQE X-IronPort-AV: E=Sophos;i="5.11,672,1422918000"; d="scan'208";a="113991825" Received: from mout.gmx.net ([212.227.15.18]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Apr 2015 00:03:25 +0200 Received: from [192.168.1.77] ([187.233.97.43]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0M4nYT-1ZCeyP06FZ-00yyYM; Thu, 30 Apr 2015 00:03:24 +0200 Message-ID: <55415529.2010802@gmx.net> Date: Wed, 29 Apr 2015 17:03:21 -0500 From: Helmut Brandl User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: caml-list@inria.fr References: <553E9CD0.5040203@gmx.net> <553EB228.9080801@frisch.fr> <0AF7BAC7BE62417CB13C1B30392B80CC@erratique.ch> <553F3C86.4060809@frisch.fr> <553F6C57.50407@zoho.com> In-Reply-To: <553F6C57.50407@zoho.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:rh+UPX93yrO5gb/rvP5VXg4EOVgRUoijHTeb6z+0AgR/Vyd0Wbx dUtmO9J8CmQrMG8489mzfypwMfI2XwOIYOcvqJG3lZHwsXRQKLEa4HDD7H6mht6LZNR07uK ZRu4uTl0SbIYJSKTTR7ZR/7Prq+PnP0Yt3Lxg4e063CyH4WyGefjHhb4bDeNsy30L95SX7g 8CH80ypvqfo8DJemoo7jQ== X-UI-Out-Filterresults: notjunk:1; Subject: Re: [Caml-list] js_of_ocaml with node Thanks to all for the hints. I think I have to dig into the documentation of js_of_ocaml to resolve the problem. Regards Helmut On 04/28/2015 06:17 AM, Drup wrote: > You can go one step further here and expose lwt threads instead. It > could be done automatically too, since transforming callbacks into lwt > thread is always done the same way. > > Le 28/04/2015 09:53, Alain Frisch a écrit : >> On 04/28/2015 12:41 AM, Daniel Bünzli wrote: >>> Le mardi, 28 avril 2015 à 00:03, Alain Frisch a écrit : >>>> val mkdir: string -> int -> unit >>>> [@@js.global "fs.mkdirAsync"] >>> >>> That should be "fs.mkdirSync". >> >> Indeed! >> >>> Just curious, how would the binding to the async fs.mkdir look like ? >> >> Something like: >> >> val mkdir_async: string -> int -> (js_exn option -> unit) -> unit >> [@@js.global "fs.mkdir"] >> >> assuming some predefined bindings for js_exn. (One could also decide >> to bind JS exception to OCaml's exn type, but the gain is not clear.) >> >> There are other possible variations, such as making the mode optional: >> >> val mkdir_async: >> string -> >> ?mode:(int[@js.default 0o777]) -> >> (js_exn option -> unit) -> >> unit >> [@@js.global "fs.mkdir"] >> >> >> Here js.default forces the default value for the optional mode >> argument. Without it, a missing value will send an `undefined` as >> the second argument (I don't know if fs.mkdir would be happy with >> it). This is currently not supported, but one could also extend the >> tool to allow: >> >> val mkdir_async: >> string -> >> ?mode:(int[@js.drop_if_missing]) -> >> (js_exn option -> unit) -> unit >> [@@js.global "fs.mkdir"] >> >> so that the second argument is dropped in the JS call if not provided >> (but I don't see how to support that for OCaml callbacks in full >> generality, since the function needs to check the type of arguments >> to decide how to interpret them). >> >> >> Alain >> > > >