caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Frédéric van der Plancke" <fvdp@decis.be>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Representation of different polymorphic variants guaranteed to be different?
Date: Wed, 08 Jul 2009 21:36:41 +0200	[thread overview]
Message-ID: <4A54F549.70205@decis.be> (raw)
In-Reply-To: <20090708185415.GB11681@localhost>

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.



      parent reply	other threads:[~2009-07-08 19:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-08 18:35 Bruno Daniel
2009-07-08 18:54 ` [Caml-list] " Eric Cooper
2009-07-08 19:32   ` Elnatan Reisner
2009-07-08 19:32   ` Bruno Daniel
2009-07-08 19:36   ` Frédéric van der Plancke [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A54F549.70205@decis.be \
    --to=fvdp@decis.be \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).