From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 0A17BBCAE for ; Thu, 30 Jun 2005 14:32:25 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5UCWOMQ018309 for ; Thu, 30 Jun 2005 14:32:24 +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 OAA16852 for ; Thu, 30 Jun 2005 14:32:24 +0200 (MET DST) From: padiolea@irisa.fr Received: from smtp.irisa.fr (smtp.irisa.fr [131.254.254.26]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5UCWNih018304; Thu, 30 Jun 2005 14:32:23 +0200 Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost.irisa.fr (Postfix) with ESMTP id B5701FAE7; Thu, 30 Jun 2005 14:32:23 +0200 (CEST) Received: from smtp.irisa.fr ([131.254.254.26]) by localhost (meli.irisa.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07211-05; Thu, 30 Jun 2005 14:32:21 +0200 (CEST) Received: from mail.irisa.fr (melo.irisa.fr [131.254.254.28]) by smtp.irisa.fr (Postfix) with ESMTP id CEE79FAE0; Thu, 30 Jun 2005 14:32:21 +0200 (CEST) Received: from 131.254.50.45 (SquirrelMail authenticated user padiolea) by mail.irisa.fr with HTTP; Thu, 30 Jun 2005 14:32:21 +0200 (CEST) Message-ID: <42164.131.254.50.45.1120134741.squirrel@mail.irisa.fr> In-Reply-To: <42C3E362.6070606@inria.fr> References: <20050629.023111.15476874.debian00@tiscali.be> <42C3E362.6070606@inria.fr> Date: Thu, 30 Jun 2005 14:32:21 +0200 (CEST) Subject: Re: [Caml-list] Type abstraction and (polymorphic) equality To: "Alain Frisch" Cc: "Christophe TROESTLER" , "O'Caml Mailing List" User-Agent: SquirrelMail/1.4.5 [CVS] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at irisa.fr X-Miltered: at nez-perce with ID 42C3E658.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42C3E657.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; irisa:01 caml-list:01 abstraction:01 christophe:01 troestler:01 hash:01 hardcoded:01 compiler:01 runtime:01 compiler:01 runtime:01 caml-list:01 beginner's:01 ocaml:01 beginners:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.2 required=5.0 tests=NO_REAL_NAME 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. I know many people who have "defunctorized" the Map and Set modules and hardcoded a call to the generic compare to be able to use Set and Map as easily as you use List. Even with this generic compare those Set and Map seems quite good enough (and far better of course that using List for representing sets and associations). > You know better than the compiler and the runtime > system how your data is to be compared, Well then you are perhaps agree with the C++ folks who think that they better know how to manage memory than the compiler and runtime system. > 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. Which one ? I know Tywith but it is not in the standard distribution and it requires camlp4 and there is sometimes some annoying behaviour when you use camlp4 (such as backtraces that points to wrong information) > 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 > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >