From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 26436BCAE for ; Thu, 30 Jun 2005 14:19:47 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j5UCJkng029854 for ; Thu, 30 Jun 2005 14:19:46 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA16522 for ; Thu, 30 Jun 2005 14:19:46 +0200 (MET DST) Received: from [128.93.11.101] (buzet.inria.fr [128.93.11.101]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5UCJkRx016807 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Jun 2005 14:19:46 +0200 Message-ID: <42C3E362.6070606@inria.fr> Date: Thu, 30 Jun 2005 14:19:46 +0200 From: Alain Frisch User-Agent: Debian Thunderbird 1.0 (X11/20050116) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christophe TROESTLER Cc: "O'Caml Mailing List" Subject: Re: [Caml-list] Type abstraction and (polymorphic) equality References: <20050629.023111.15476874.debian00@tiscali.be> In-Reply-To: <20050629.023111.15476874.debian00@tiscali.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 42C3E362.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42C3E362.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; frisch:01 frisch:01 caml-list:01 abstraction:01 christophe:01 troestler:01 hash:01 compiler:01 runtime:01 ...:98 wrote:01 equality:01 polymorphic:01 functions:01 functions:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Christophe TROESTLER wrote: > I'll be glad to hear similar experiences and comments about the above > ideas. In my opinion, it is a good idea to always define one's own comparison (and hash) function. You know better than the compiler and the runtime system how your data is to be compared, which details should be ignored, how to deal with cycles, and so on. In addition, your custom functions will be more efficient than the generic ones. There are several tools to generate automatically comparison functions from type declarations. I often redefine the comparison operators (=), (<=), ... with dummy types at the beginning of modules to avoid using them by inadvertence (this does not catch uses of List.mem-like functions, though). -- Alain