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=AWL autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 59FF1BC69 for ; Mon, 14 Jan 2008 18:21:56 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq4HAEUpi0fUnw7UhWdsb2JhbACCNI1SAQEBCAQGDxMHmDk X-IronPort-AV: E=Sophos;i="4.24,283,1196636400"; d="scan'208";a="7789137" Received: from ptb-relay01.plus.net ([212.159.14.212]) by mail3-smtp-sop.national.inria.fr with ESMTP; 14 Jan 2008 18:21:55 +0100 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay01.plus.net with esmtp (Exim) id 1JET0U-0004xL-RD for caml-list@yquem.inria.fr; Mon, 14 Jan 2008 17:21:55 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Hash clash in polymorphic variants Date: Mon, 14 Jan 2008 17:14:39 +0000 User-Agent: KMail/1.9.7 References: <200801101709.14110.jon@ffconsultancy.com> <200801140720.02094.ober.14@osu.edu> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801141714.39963.jon@ffconsultancy.com> X-Spam: no; 0.00; hash:01 variants:01 hash:01 hashing:01 inputs:01 inputs:01 ocaml:01 compilation:01 variants:01 frog:98 polymorphic:01 polymorphic:01 wrote:01 dynamically:01 compile:01 On Monday 14 January 2008 14:44:58 Stefan Monnier wrote: > > What I meant was simply that instead of using some fixed hash function, > > one could use a perfect hashing function which is optimal for its known > > set of inputs, and won't ever generate a collision. > > The problem is that the set of inputs is not know at compile time, only > at link time. Yes. I think this is another case where OCaml would really benefit from a symbol table and this is something else that seems much easier to do with JIT compilation. Also, what happens if you try to dynamically load two libraries that use polymorphic variants that clash? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e