Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Eric Cooper <ecc@cmu.edu>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Maximum non-constant constructors
Date: Thu, 17 Mar 2005 09:00:34 -0500	[thread overview]
Message-ID: <20050317140034.GA7049@localhost> (raw)
In-Reply-To: <16953.31187.263581.694769@gargle.gargle.HOWL>

On Thu, Mar 17, 2005 at 01:36:35PM +0100, Jean-Christophe Filliatre wrote:
> 
> Richard Jones writes:
>  > 
>  > Has anyone ever seen (in real life) a collision in the hash function
>  > which encodes polymorphic variants?  Just wondering ...  It seems like
>  > it could occur.
> 
> Yes it could occur, but there is a check a link time for such collisions.

Out of curiousity, I wrote a short program to enumerate possible
collisions.  (If you examine the hash_variant function in
typing/btype.ml, it's clear that any base-223 representation of a
multiple of 2^31 in which the "digits" are legal identifier characters
will hash to zero, and will therefore be an "invisible prefix".)

For example, for all strings XXX, the variants `XXX and `zyctRecXXX
collide.

Here's a small sampling of other invisible prefixes:

    CibPXd UMEDdm d1usNc hS1P1' jagJhn oZshTt Atmtemb CAoStes DHobutv
    PeoQMeo SQufoxX alzzdgn dRtEXEl eeAnNdc glMavfi stYKKKs vbasThr

My guess is that none of them are likely to be chosen by
humans, but might occur in program-generated code.

-- 
Eric Cooper             e c c @ c m u . e d u


  reply	other threads:[~2005-03-17 14:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-16 19:51 Tom Hawkins
2005-03-16 20:42 ` [Caml-list] " Alain Frisch
2005-03-16 23:22   ` Tom Hawkins
2005-03-17 15:23     ` Stefan Monnier
2005-03-16 23:32   ` [Caml-list] " Richard Jones
2005-03-17 12:36     ` Jean-Christophe Filliatre
2005-03-17 14:00       ` Eric Cooper [this message]
2005-03-17 17:32         ` Marcin 'Qrczak' Kowalczyk
2005-03-17 18:27           ` Richard Jones
2005-03-17 17:55         ` Jon Harrop
2005-03-19  2:28           ` Jacques Garrigue

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=20050317140034.GA7049@localhost \
    --to=ecc@cmu.edu \
    --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