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 163347F61E for ; Sun, 5 Nov 2017 19:24:58 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=rich@annexia.org; spf=Pass smtp.mailfrom=rich@annexia.org; spf=Pass smtp.helo=postmaster@annexia.org Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of rich@annexia.org) identity=pra; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of rich@annexia.org designates 80.68.91.176 as permitted sender) identity=mailfrom; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@annexia.org designates 80.68.91.176 as permitted sender) identity=helo; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="postmaster@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" IronPort-PHdr: =?us-ascii?q?9a23=3A/U46MhIWIBDmJ2nUMtmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgUKvrxwZ3uMQTl6Ol3ixeRBMOAtKIC1rKempujcFJDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBX660e/5j8KGxj5KRE9?= =?us-ascii?q?ZqGsQtaT3IyL0LX4w5DPfwhSzBP7KY5oLxi6pAGb/p0OiJZ4Kas9wx/hrX5Beu?= =?us-ascii?q?AQzmRtcwG9hRH5s42K/ZVj+j5c881n0ogIc6L8cr9yBehCDT8mG2kz4sD7tBCF?= =?us-ascii?q?ShGAsChPGl4KmwZFVlCWpCrxWY38526j7rJw?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BeAgDAVv9Z/7BbRFBcGwEBAQMBAQEJA?= =?us-ascii?q?QEBgzRkbiedNUUGgTGYVwong38BgRQChFdDFAEBAQEBAQEBAQFqKII4BQEeAQW?= =?us-ascii?q?CPQEFOj8QCxgJExIPLRsGLol7EQysN4sFAQEIAQEBASSDLoIHgQw9gXODKosIB?= =?us-ascii?q?aIOAodkg2eJIpNBjGGJNYE5NiGBbIEHCEmCZAmEVkE2BYoagVUBAQE?= X-IPAS-Result: =?us-ascii?q?A0BeAgDAVv9Z/7BbRFBcGwEBAQMBAQEJAQEBgzRkbiedNUU?= =?us-ascii?q?GgTGYVwong38BgRQChFdDFAEBAQEBAQEBAQFqKII4BQEeAQWCPQEFOj8QCxgJE?= =?us-ascii?q?xIPLRsGLol7EQysN4sFAQEIAQEBASSDLoIHgQw9gXODKosIBaIOAodkg2eJIpN?= =?us-ascii?q?BjGGJNYE5NiGBbIEHCEmCZAmEVkE2BYoagVUBAQE?= X-IronPort-AV: E=Sophos;i="5.44,348,1505772000"; d="scan'208";a="299384227" Received: from annexia.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-GCM-SHA384; 05 Nov 2017 19:24:57 +0100 Received: from rich by annexia.org with local (Exim 4.89) (envelope-from ) id 1eBPbM-00005H-LV; Sun, 05 Nov 2017 18:24:56 +0000 Date: Sun, 5 Nov 2017 18:24:56 +0000 From: "Richard W.M. Jones" To: "Petter A. Urkedal" Cc: caml-list Message-ID: <20171105182456.bcx2ueyxulcqouyp@annexia.org> References: <86o9p2ywgc.fsf@gmail.com> <20171020113815.GD32138@nunchakus.loria.fr> <20171024133026.uovvzdbnamnzoknv@annexia.org> <20171104184401.3el2vbha2tgpvse5@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [Caml-list] What if exn was not an open type? On Sun, Nov 05, 2017 at 07:02:12PM +0100, Petter A. Urkedal wrote: > I vouch for octachron solution to the lack of polymorphism in the > return function. > > I tried to reformat the inspect_fs_unix_fstab.ml more along my own > coding style to get a feel for the issue: > > https://gist.github.com/paurkedal/80b89c8fabe041e62eccc596d51f382b > > What doesn't work with this style is falling though to the next block, > though I'm not sure that's I good for maintainability anyway. This > is, however, even further away from the C style. That appears to mainly play with indentation, which just means that our tools won't work well. FWIW here's the updated version I ended up with: https://gist.github.com/rwmjones/426821925fd1250096d7ddaac4103a12#file-gistfile1-txt-L57 This was formed by going back to the original C code: https://github.com/libguestfs/libguestfs/blob/5b74dd98a7926191cc085fc36be57f58bd6d80d8/lib/inspect-fs-unix.c#L1273 and rearranging the OCaml code to look more like it, adding return statements to achieve this. For those wondering why, the aim here is to translate the code from C to OCaml as closely as possible (at first) in order to minimize the inevitable bugs that will be added during the translation. The C code is very well tested over years. I have plans to rework the code completely later to make real use of OCaml, but first don't break things. Rich.