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 0BCA67F61E for ; Sat, 4 Nov 2017 19:53:56 +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=3A5dKvnxb1eJ47+ufYkwwDAsv/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpsq/bnLW6fgltlLVR4KTs6sC0LWG9f24EUU7or+/81k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i76vnYuHUDEDUIh?= =?us-ascii?q?PfzdHZTYjti+0+6169vYZAAe1xSnZrYnZi+3pgXYrMVevs1HbO4TzR3EuTEAL/?= =?us-ascii?q?5XzmNALFSVkgb974G35pE1oHcYgO4o68MVCfayRK8/V7ENVDk=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CXBwAmDP5Z/7BbRFBcHAEBBAEBCgEBg?= =?us-ascii?q?zSBUp1eQwEBBoExmFcKhCYBgRQChFdDFAEBAQEBAQEBAQFqKII4IoJEAQEBAQI?= =?us-ascii?q?BOjIKAxALGAkTEg8tGwYtiXwFDKsPiwgBAQEHAiaDLoIHgQw9hR2LCAWZBokIA?= =?us-ascii?q?pRtk0GWFoE5NiGBbIEHCEmCZYReQY0eAQEB?= X-IPAS-Result: =?us-ascii?q?A0CXBwAmDP5Z/7BbRFBcHAEBBAEBCgEBgzSBUp1eQwEBBoE?= =?us-ascii?q?xmFcKhCYBgRQChFdDFAEBAQEBAQEBAQFqKII4IoJEAQEBAQIBOjIKAxALGAkTE?= =?us-ascii?q?g8tGwYtiXwFDKsPiwgBAQEHAiaDLoIHgQw9hR2LCAWZBokIApRtk0GWFoE5NiG?= =?us-ascii?q?BbIEHCEmCZYReQY0eAQEB?= X-IronPort-AV: E=Sophos;i="5.44,343,1505772000"; d="scan'208";a="299308141" Received: from annexia.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-GCM-SHA384; 04 Nov 2017 19:53:55 +0100 Received: from rich by annexia.org with local (Exim 4.89) (envelope-from ) id 1eB3Zq-0004Nk-Fi; Sat, 04 Nov 2017 18:53:54 +0000 Date: Sat, 4 Nov 2017 18:53:54 +0000 From: "Richard W.M. Jones" To: SP Cc: caml-list@inria.fr Message-ID: <20171104185354.2wlsvr57b66gl4pg@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 Sat, Nov 04, 2017 at 06:48:34PM +0000, SP wrote: > On 04/11/2017 18:44, Richard W.M. Jones wrote: > > As promised, I tried rewriting some code with this style. The > > good news is that it does look a lot more like the original C code. > > The bad news is that with_return as defined above doesn't really work > > like the C return statement, as in the small example below. The > > example is very contrived but it reflects a problem that I found in > > real code. > > The good news, is that if you really want to write this in C style, just > write it in C and bind to it from OCaml. I don't want to write it in C, as OCaml has considerable advantages. In fact, the code was converted from C to gain these advantages already. > > The problem is that the return statement could be called from many > > contexts, all with different types. The compiler expects to unify all > > these types (as the same type 'b) which is not possible. > > > > It wasn't immediately clear to me if this was solvable. > > I think you can define a generic return. I'm not familiar with this, what is the "generic return"? Rich. -- Richard Jones