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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 86F90BC6B for ; Thu, 10 Jan 2008 22:32:10 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CANsdhkfUnw6GhWdsb2JhbACCNI1rAQEBCAIIBwgTB5kX X-IronPort-AV: E=Sophos;i="4.24,268,1196636400"; d="scan'208";a="6512629" Received: from pih-relay08.plus.net ([212.159.14.134]) by mail1-smtp-roc.national.inria.fr with ESMTP; 10 Jan 2008 22:32:10 +0100 Received: from [80.229.56.224] (helo=beast.local) by pih-relay08.plus.net with esmtp (Exim) id 1JD50T-0002XB-Dt for caml-list@yquem.inria.fr; Thu, 10 Jan 2008 21:32:09 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Hash clash in polymorphic variants Date: Thu, 10 Jan 2008 21:24:26 +0000 User-Agent: KMail/1.9.7 References: <200801101709.14110.jon@ffconsultancy.com> <20080110203534.GB12491@stratocaster.home> In-Reply-To: <20080110203534.GB12491@stratocaster.home> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801102124.26245.jon@ffconsultancy.com> X-Spam: no; 0.00; hash:01 variants:01 constructors:01 avoided:01 clashing:01 hash:01 variants:01 translating:01 enum:01 10,:98 frog:98 polymorphic:01 polymorphic:01 wrote:01 wrote:01 On Thursday 10 January 2008 20:35:34 Eric Cooper wrote: > On Thu, Jan 10, 2008 at 05:09:13PM +0000, Jon Harrop wrote: > > ISTR advice that constructors sharing the first few characters should be > > avoided in order to reduce the likelihood of clashing hash values for > > polymorphic variants. Is that right? > > I don't think it's worth worrying about. > > I wrote a program a while ago to look into this. I never saw any > "human-sensible" collisions (between two identifiers that a person > might have chosen). And if you're producing gensyms in a program, you > can just check ahead of time. I'm interested in automatically translating the GL_* enum from OpenGL into polymorphic variants. So although it is generated code I have little control over it, e.g. I cannot change the translation as OpenGL gets extended because code will already be using the existing names. Still, maybe I'm over-reacting. ;-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e