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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 538B97FC86 for ; Thu, 19 Mar 2015 18:41:57 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of yallop@gmail.com) identity=pra; client-ip=209.85.192.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of yallop@gmail.com designates 209.85.192.45 as permitted sender) identity=mailfrom; client-ip=209.85.192.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qg0-f45.google.com) identity=helo; client-ip=209.85.192.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="postmaster@mail-qg0-f45.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BuAACsCQtVlC3AVdFchCYMBIMJyRECgUUHTAEBAQEBAREBAQEBBwsLCRIwhBABAQQSER0BGx0BAwwGBQsNAgImAgIiAREBBQEcBjWHeAEDEaYMPjGLMYFrgneRHgoZJw1UhFUBAQEBAQUBAQEBGAEFDoETiXaEPjMHgmiBRQWaOZJeEiOBDAmEED4xgkMBAQE X-IPAS-Result: A0BuAACsCQtVlC3AVdFchCYMBIMJyRECgUUHTAEBAQEBAREBAQEBBwsLCRIwhBABAQQSER0BGx0BAwwGBQsNAgImAgIiAREBBQEcBjWHeAEDEaYMPjGLMYFrgneRHgoZJw1UhFUBAQEBAQUBAQEBGAEFDoETiXaEPjMHgmiBRQWaOZJeEiOBDAmEED4xgkMBAQE X-IronPort-AV: E=Sophos;i="5.11,431,1422918000"; d="scan'208";a="104026912" Received: from mail-qg0-f45.google.com ([209.85.192.45]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 19 Mar 2015 18:41:56 +0100 Received: by qgh62 with SMTP id 62so71842806qgh.1 for ; Thu, 19 Mar 2015 10:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=6Otif4iQCeTbkaEK3AH1r2urXE6dfDjAUhqih8p4JhQ=; b=cbyZAx74vnK2+d9W0vsjgdnrNdQpJ845IwkT9VrkqhZHCtkU75xDdMXoT5gyQlMeiX lt44124cYsKd39YqwicgGWnkJZFja1xGqKHMkwEFacnx3H7BMjRUf08jzBdprHkSokCW 7cJAgFUCA4I4W3Zb/WmKPoWdhNsaJp3OLB+YJaUoYCHNeCoxzOD5evmTVL1QNrwruPCJ wtu4T0Q0WYVpiHGEBRUOmehjjrzAesELGASeVhTh8wVZWmNQNoodJrfy97cFyD5c0hUr hTlLpHZbU9PQyaZ7joID3aLLewv/b+PsCuU5oOwgu63jTWWZG62/TmZneaHCqGw1Hsox tyCA== MIME-Version: 1.0 X-Received: by 10.140.96.165 with SMTP id k34mr93525467qge.79.1426786915773; Thu, 19 Mar 2015 10:41:55 -0700 (PDT) Received: by 10.229.160.11 with HTTP; Thu, 19 Mar 2015 10:41:55 -0700 (PDT) In-Reply-To: References: <2AB388B4D07D4DDABA30298A7C890319@erratique.ch> <596DAEC11B474882835CEA10AAACE35E@erratique.ch> <87E7B1EBF3144E7C844448D0F5EBB407@erratique.ch> Date: Thu, 19 Mar 2015 17:41:55 +0000 Message-ID: From: Jeremy Yallop To: =?UTF-8?Q?Milan_Stanojevi=C4=87?= Cc: =?UTF-8?Q?Daniel_B=C3=BCnzli?= , Jeremie Dimino , Caml-list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] GADT existential escape Daniel B=C3=BCnzli wrote: >> N.B. As it stands this is slightly less efficient than using open varian= ts, since you'd have to allocate an exn value for checking equality. Milan Stanojevi=C4=87: > Exceptions and open variants are actually exactly the same. More precisely, the exn type is a particular extensible variant with some additional syntactic sugar. The exn type doesn't support GADT constructors (since it doesn't have type parameters), so it can't be used to implement the typed keys under discussion -- at least, not in the same way as Core's extensible-variant-based implementation. The point here, though, is that Daniel's code allocates: match R.E W.w with while the version using open variants does not allocate: match A.Key with Jeremy.