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 09DE3BCAF for ; Wed, 29 Jun 2005 11:45:34 +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 j5T9jXVo018986 for ; Wed, 29 Jun 2005 11:45:33 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA29575 for ; Wed, 29 Jun 2005 11:45:33 +0200 (MET DST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j5T9jWkN018979 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 29 Jun 2005 11:45:33 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id AFB4719E6EF; Wed, 29 Jun 2005 11:45:32 +0200 (CEST) Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12672-07; Wed, 29 Jun 2005 11:45:32 +0200 (CEST) Received: from smtp.lri.fr (serveur3-5 [129.175.3.5]) by ext.lri.fr (Postfix) with ESMTP id 9D84C19E6D3; Wed, 29 Jun 2005 11:45:32 +0200 (CEST) Received: from pc9-152 (pc9-152 [129.175.9.152]) by smtp.lri.fr (Postfix) with ESMTP id C7BFBCED89; Wed, 29 Jun 2005 11:45:31 +0200 (CEST) Received: from filliatr by pc9-152 with local (Exim 3.36 #1 (Debian)) id 1DnZ8O-00077u-00; Wed, 29 Jun 2005 11:45:32 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17090.28092.467216.994306@gargle.gargle.HOWL> Date: Wed, 29 Jun 2005 11:45:32 +0200 To: Christophe TROESTLER Cc: "O'Caml Mailing List" Subject: Re: [Caml-list] Type abstraction and (polymorphic) equality In-Reply-To: <20050629.023111.15476874.debian00@tiscali.be> References: <20050629.023111.15476874.debian00@tiscali.be> X-Mailer: VM 7.19 under Emacs 21.4.1 From: Jean-Christophe Filliatre X-Virus-Scanned: by amavisd-new at lri.fr X-Miltered: at concorde with ID 42C26DBD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42C26DBC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 abstraction:01 filliatre:01 filliatre:01 lri:01 christophe:01 troestler:01 bumped:01 verbose:01 debugger:01 datatypes:01 ...:98 equality:01 equality:01 writes: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 writes: > > The problem was that the attached information (an additional field in > a record) was a cyclic data structure. From there on, all equality > tests became deadly! > ... I fully agree. I bumped into this issue a few months ago and helped a friend of mine to discover the same issue no later than yesterday! It is actually not really difficult to identify this issue: first, the Out_of_memory is raised very quickly; second, there is an explicit message when the Gc verbose mode is activated; finally, it is quite easy to find it with the debugger (one "run" and then one "back" will tell you that the Out_of_memory is raised during a structual comparison). But that's not the point. I have no good solution to propose, but it would be nice if we were not allowed to apply structural comparison on abstract (or private) datatypes. Then you would have to export an explicit equality function, and even if you are going to define it as (=) most of the time, you would have to think about it at least one second. But I agree that it is quite difficult to incorporate this in the type system. -- Jean-Christophe