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 72F7E7FCCB for ; Tue, 28 Apr 2015 09:53:43 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=85.233.204.164; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=85.233.204.164; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mx20.yaziba.net) identity=helo; client-ip=85.233.204.164; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@mx20.yaziba.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ARAQA1PD9VnKTM6VVcg1+DdsNmCYFKhgwCgTM4FAEBAQEBAQERAQEBAQEICwkJIS6EIAEBAQMBIwQRNAoCAQULCxgCAgUWCwICCQMCAQIBRQYNAQcBAYgfDLIulAUBAQEBBgEBAQEBHYEhiheFBQeCaIFFAQSPM4YjhjiHOYRmiUAChBmDMQEBAQ X-IPAS-Result: A0ARAQA1PD9VnKTM6VVcg1+DdsNmCYFKhgwCgTM4FAEBAQEBAQERAQEBAQEICwkJIS6EIAEBAQMBIwQRNAoCAQULCxgCAgUWCwICCQMCAQIBRQYNAQcBAYgfDLIulAUBAQEBBgEBAQEBHYEhiheFBQeCaIFFAQSPM4YjhjiHOYRmiUAChBmDMQEBAQ X-IronPort-AV: E=Sophos;i="5.11,662,1422918000"; d="scan'208";a="137892475" Received: from mx20.yaziba.net ([85.233.204.164]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 28 Apr 2015 09:53:43 +0200 Received: from mta10.int.yaziba.net (unknown [10.4.20.30]) by mx20.yaziba.net (mx10.yaziba.net) with ESMTP id AA0BC1A7466; Tue, 28 Apr 2015 09:53:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta10.int.yaziba.net (Postfix) with ESMTP id C172DCA66F; Tue, 28 Apr 2015 09:53:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at mta10.int.yaziba.net Received: from mta10.int.yaziba.net ([127.0.0.1]) by localhost (mta10.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5YTcXxPcSMfY; Tue, 28 Apr 2015 09:53:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta10.int.yaziba.net (Postfix) with ESMTP id 9CF4FCA671; Tue, 28 Apr 2015 09:53:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at mta10.int.yaziba.net Received: from mta10.int.yaziba.net ([127.0.0.1]) by localhost (mta10.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id jQf8kDOb_LJT; Tue, 28 Apr 2015 09:53:42 +0200 (CEST) Received: from [10.0.48.241] (unknown [185.23.92.144]) by mta10.int.yaziba.net (Postfix) with ESMTPSA id 82E52CA66F; Tue, 28 Apr 2015 09:53:42 +0200 (CEST) Message-ID: <553F3C86.4060809@frisch.fr> Date: Tue, 28 Apr 2015 09:53:42 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: =?UTF-8?B?RGFuaWVsIELDvG56bGk=?= CC: Helmut Brandl , caml-list@inria.fr References: <553E9CD0.5040203@gmx.net> <553EB228.9080801@frisch.fr> <0AF7BAC7BE62417CB13C1B30392B80CC@erratique.ch> In-Reply-To: <0AF7BAC7BE62417CB13C1B30392B80CC@erratique.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrfeektddrieekgddufedtucetufdoteggodetrfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkfffhfgggvffufhgjtgfgsehtqhgrtddtfeejnecuhfhrohhmpeetlhgrihhnucfhrhhishgthhcuoegrlhgrihhnsehfrhhishgthhdrfhhrqe X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht X-Validation-by: alain.frisch@lexifi.com Subject: Re: [Caml-list] js_of_ocaml with node On 04/28/2015 12:41 AM, Daniel B=C3=BCnzli wrote: > Le mardi, 28 avril 2015 =C3=A0 00:03, Alain Frisch a =C3=A9crit : >> 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=20 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.=20 Without it, a missing value will send an `undefined` as the second=20 argument (I don't know if fs.mkdir would be happy with it). This is=20 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=20 (but I don't see how to support that for OCaml callbacks in full=20 generality, since the function needs to check the type of arguments to=20 decide how to interpret them). Alain