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 A7B3E7FF36 for ; Wed, 27 Jul 2016 10:38:25 +0200 (CEST) IronPort-PHdr: 9a23:1T2dbRcNg/JVaGNY0jzrCSPZlGMj4u6mDksu8pMizoh2WeGdxc69YR7h7PlgxGXEQZ/co6odzbGH6+a+BCQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd+KyZrqn8mJuLTrKz1SgzS8Zb4gZD6Xli728vcsvI15N6wqwQHIqHYbM85fxGdvOE7B102kvpT41NdZ/i9Ro/Ms8dJbGeW/JvxgDO8QMDNzHGk//szmsVH4RguC/HYGGjEZmxBSAgXBqgrxXprrvzHSue902S3cNsrzG+MaQzOnuo5vQR7uwAkdNiUy8CmDg8h5jaQdrgigvBd/64rZcICbNbx1eaaLLoBSfnZIQssED38JOYi7dYZaSrNZZes= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=alain.frisch@lexifi.com; spf=None smtp.mailfrom=alain.frisch@lexifi.com; spf=None smtp.helo=postmaster@mx20.yaziba.net Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain.frisch@lexifi.com) identity=pra; client-ip=85.233.204.164; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain.frisch@lexifi.com"; x-sender="alain.frisch@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain.frisch@lexifi.com) identity=mailfrom; client-ip=85.233.204.164; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain.frisch@lexifi.com"; x-sender="alain.frisch@lexifi.com"; 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@lexifi.com"; x-sender="postmaster@mx20.yaziba.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BvAgDRcZhXh6TM6VVVCYQ/u0yGHQKBLzwQAQEBAQEBAQERAQEBCgsJCRkvgjIEARIBghIBAQQBIxVBBQsLGAICJgICVwYNCAEBiCUMrQ+NXgEBAQEGAQEBAQEigQGFKYF4glWEGYMogloFmTGBYI0ciVSFa4wtg3YCNYJAgVmJLQEBAQ X-IPAS-Result: A0BvAgDRcZhXh6TM6VVVCYQ/u0yGHQKBLzwQAQEBAQEBAQERAQEBCgsJCRkvgjIEARIBghIBAQQBIxVBBQsLGAICJgICVwYNCAEBiCUMrQ+NXgEBAQEGAQEBAQEigQGFKYF4glWEGYMogloFmTGBYI0ciVSFa4wtg3YCNYJAgVmJLQEBAQ X-IronPort-AV: E=Sophos;i="5.28,429,1464645600"; d="scan'208";a="228095753" Received: from mx20.yaziba.net ([85.233.204.164]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 Jul 2016 10:38:25 +0200 Received: from mta10.int.yaziba.net (mta10.int.yaziba.net [10.4.20.30]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx20.yaziba.net (mx10.yaziba.net) with ESMTPS id CC77B1A8162; Wed, 27 Jul 2016 10:38:24 +0200 (CEST) Received: from mta10.int.yaziba.net (localhost [127.0.0.1]) by mta10.int.yaziba.net (Postfix) with ESMTPS id E9B18CA72A; Wed, 27 Jul 2016 10:38:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta10.int.yaziba.net (Postfix) with ESMTP id D7BF1CA756; Wed, 27 Jul 2016 10:38:24 +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 04jHcItUsHD9; Wed, 27 Jul 2016 10:38:24 +0200 (CEST) Received: from [10.0.210.146] (unknown [185.23.92.144]) by mta10.int.yaziba.net (Postfix) with ESMTPSA id AEDE5CA72A; Wed, 27 Jul 2016 10:38:24 +0200 (CEST) To: Gabriel Scherer References: <64e8e1be-7081-d683-e777-6f377968f36c@gmail.com> <07e4f1d2-f61f-4047-b1a0-7339b78825e3@lexifi.com> <1469525797.2529112.676963937.25E14FD6@webmail.messagingengine.com> <14e4dd61-7ff6-fdef-c103-a33c4f728bd9@lexifi.com> Cc: Leo White , caml users From: Alain Frisch Message-ID: <22f40288-b8ca-6b16-f9c8-735ceb1d2617@lexifi.com> Date: Wed, 27 Jul 2016 10:38:20 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrfeeltddrieehgddthecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpjgetkgfkueetnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetlhgrihhnucfhrhhishgthhcuoegrlhgrihhnrdhfrhhishgthheslhgvgihifhhirdgtohhmqeenucfkphepudekhedrvdefrdelvddrudeggeenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Subject: Re: [Caml-list] exception Foo = Bar.Baz On 27/07/2016 10:27, Gabriel Scherer wrote: > You can already eliminate one of the two comparisons if both A are > statically known to be the same. You could check if A is equal B on the raise site and jump to the correct handler depending on the result, but this approach could in general produce much bigger code (you need to check equality with all intermediate exception constructors with the same arity on each such raise). > Moreover, cross-module optimization > information is likely to give you the actual definition of both A and > B -- if they are just defined with either "exception Foo" or > "exception Bar = Baz" as a structure item of the compilation unit > level, their identity will be known. Indeed, good point. Thanks also to Leo for providing a good use case (renaming on functor boundaries). Alain