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 C79AA7F61E for ; Sat, 4 Nov 2017 19:48:36 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=sp@orbitalfox.com; spf=None smtp.mailfrom=sp@orbitalfox.com; spf=None smtp.helo=postmaster@orbitalfox.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of sp@orbitalfox.com) identity=pra; client-ip=95.172.232.202; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="sp@orbitalfox.com"; x-sender="sp@orbitalfox.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of sp@orbitalfox.com) identity=mailfrom; client-ip=95.172.232.202; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="sp@orbitalfox.com"; x-sender="sp@orbitalfox.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@orbitalfox.com) identity=helo; client-ip=95.172.232.202; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="sp@orbitalfox.com"; x-sender="postmaster@orbitalfox.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AinqoeB3YVZJQcc3QsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?sesSLvad9pjvdHbS+e9qxAeQG96Eu7QZ06L/iOPJZy8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tLw6annrn5jcXHlD7NBFp?= =?us-ascii?q?DuXzAI/bycqthM6o/JiGWD0A0CGlSbRoJhSqpAHfsdlQioxnfPVigiDVq2dFLr?= =?us-ascii?q?wFjVhjIkieyk7x?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DkDADMCv5Z/8rorF9cHAEBBAEBCgEBg?= =?us-ascii?q?zRnayeDfZk6gXyYV4QwAYEUAgyES0MUAQEBAQEBAQEBAWoogjgigkQBAQEBAgE?= =?us-ascii?q?jHQEBOAQLCxgCAiYCAlcTCAEBFooBDKgBa4IngwkBAQWHeAEKAQEBHAiBD4Ifg?= =?us-ascii?q?geDZYMBhV2CSYJioX4VoHSHPJdPNiGBbHoVSYJkgk2CEkE2jGgBAQE?= X-IPAS-Result: =?us-ascii?q?A0DkDADMCv5Z/8rorF9cHAEBBAEBCgEBgzRnayeDfZk6gXy?= =?us-ascii?q?YV4QwAYEUAgyES0MUAQEBAQEBAQEBAWoogjgigkQBAQEBAgEjHQEBOAQLCxgCA?= =?us-ascii?q?iYCAlcTCAEBFooBDKgBa4IngwkBAQWHeAEKAQEBHAiBD4IfggeDZYMBhV2CSYJ?= =?us-ascii?q?ioX4VoHSHPJdPNiGBbHoVSYJkgk2CEkE2jGgBAQE?= X-IronPort-AV: E=Sophos;i="5.44,343,1505772000"; d="scan'208";a="299307679" Received: from orbitalfox.com ([95.172.232.202]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Nov 2017 19:48:36 +0100 Received: from [192.168.88.5] (unknown [192.168.88.5]) by orbitalfox.com (Postfix) with ESMTPSA id 542DBAA0070 for ; Sat, 4 Nov 2017 18:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=orbitalfox.com; s=orbitalfox; t=1509821315; bh=MBj3VOWstnHAnqQnNKL8XcakRFbMQ1b9uUmBjYuPJ/A=; h=Subject:To:References:From:Date:In-Reply-To; b=RIaIwjaeyfE5GNXPDiZfVUN0/OqdJxQmpmcFJV0ugV9yGoCxSXlJcnu6Db3lvX60M 88yWnXYR/DgrCSAXHNnCcEpumrJKHXFsByRmF8ilNK5e0QswGvPsXnppDZUvH3/FFw 0npeLMCOAuS3gz3O1REIZxvHAgo1jEC6kBQsbg0c= To: caml-list@inria.fr References: <86o9p2ywgc.fsf@gmail.com> <20171020113815.GD32138@nunchakus.loria.fr> <20171024133026.uovvzdbnamnzoknv@annexia.org> <20171104184401.3el2vbha2tgpvse5@annexia.org> From: SP Message-ID: Date: Sat, 4 Nov 2017 18:48:34 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171104184401.3el2vbha2tgpvse5@annexia.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] What if exn was not an open type? 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. > 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. -- SP