caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremy Yallop <yallop@gmail.com>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: caml list <caml-list@inria.fr>
Subject: Re: [Caml-list] Stability of order between polymorphic variants
Date: Thu, 5 Sep 2013 10:26:42 +0100	[thread overview]
Message-ID: <CAAxsn=FV00_ky3Zfd8yN9H01fe2wPs5MVpmrPtsyK6M4YYmuQQ@mail.gmail.com> (raw)
In-Reply-To: <EB3B4FB66B1C49E89F3B56664559EFA1@erratique.ch>

On 5 September 2013 01:17, Daniel Bünzli <daniel.buenzli@erratique.ch> wrote:
> The question is, is the order between polymorphic variants an invariant provided by the compiler or is it subject to change ?

The order is fairly unlikely to change.  It's based on a hash function
that's used during type checking to determine whether tags can occur
in the same type:

  # [`premiums; `squigglier];;
  Characters 12-23:
    [`premiums; `squigglier];;
                ^^^^^^^^^^^
  Error: Variant tags `premiums and `squigglier have the same hash value.
         Change one of them.

Changing the hash function could cause some existing programs to be rejected.

  parent reply	other threads:[~2013-09-05  9:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05  0:17 Daniel Bünzli
2013-09-05  2:06 ` Anthony Tavener
2013-09-05  2:11   ` Anthony Tavener
2013-09-05  2:18     ` Francois Berenger
2013-09-05  2:31       ` Anthony Tavener
2013-09-05  7:47         ` Stéphane Glondu
2013-09-05  8:24 ` Jacques Garrigue
2013-09-05  8:39   ` Mark Shinwell
2013-09-05  9:26 ` Jeremy Yallop [this message]
2013-09-05 14:46   ` Goswin von Brederlow

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='CAAxsn=FV00_ky3Zfd8yN9H01fe2wPs5MVpmrPtsyK6M4YYmuQQ@mail.gmail.com' \
    --to=yallop@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /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).