From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 355A6BBAF for ; Wed, 8 Jul 2009 21:36:47 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjkFAIeRVErCTtud/2dsb2JhbACBUdAMhAgF X-IronPort-AV: E=Sophos;i="4.42,370,1243807200"; d="scan'208";a="29496170" Received: from 157.219-78-194.adsl-static.isp.belgacom.be (HELO decis.be) ([194.78.219.157]) by mail2-smtp-roc.national.inria.fr with ESMTP; 08 Jul 2009 21:36:46 +0200 X-MDAV-Processed: decis.be, Wed, 08 Jul 2009 21:37:55 +0200 Received: from [192.168.0.30] by decis.be (MDaemon PRO v10.0.4) with ESMTP id md50002345710.msg for ; Wed, 08 Jul 2009 21:37:54 +0200 X-Authenticated-Sender: fplancke@decis.be X-MDRemoteIP: 192.168.0.30 X-Return-Path: fvdp@decis.be X-Envelope-From: fvdp@decis.be X-MDaemon-Deliver-To: caml-list@yquem.inria.fr Message-ID: <4A54F549.70205@decis.be> Date: Wed, 08 Jul 2009 21:36:41 +0200 From: =?ISO-8859-1?Q?Fr=E9d=E9ric_van_der_Plancke?= User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Representation of different polymorphic variants guaranteed to be different? References: <20090708183527.GC3432@colinux> <20090708185415.GB11681@localhost> In-Reply-To: <20090708185415.GB11681@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Reply-To: fvdp@decis.be X-Spam: no; 0.00; plancke:01 variants:01 0200,:01 variants:01 translated:01 undetected:01 hash:01 2009:98 870:98 polymorphic:01 polymorphic:01 wrote:01 wrote:01 compile:01 compile:01 Eric Cooper wrote: > On Wed, Jul 08, 2009 at 08:35:27PM +0200, Bruno Daniel wrote: > >> How is it ensured that I get a <> b for a and b created as >> polymorphic variants from two different identifiers? Will pattern >> matching give wrong results if I accidentally choose two different >> identifiers translated to the same internal representation? >> > > See this thread: > http://caml.inria.fr/pub/ml-archives/caml-list/2005/03/544288096a47d82ec870d01c8396f5fe.fr.html > > Short answer: collisions could theoretically occur, but are detected > at link time. > > Actually at compile time, as stated by Jacques Garrigue* *in the last message of said thread: "By the way, the check is not at link time, as was stated in another message, but at compile time. It is the typing of variants itself that guarantees that no such conflict will go undetected. So you will be warned early enough." Example: # type a = [ `ABC | `zyctRecABC ];; Variant tags `ABC and `zyctRecABC have same hash value. Change one of them. Frédéric.