From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA21466; Fri, 23 Jul 2004 10:16:48 +0200 (MET DST) 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 KAA21899 for ; Fri, 23 Jul 2004 10:16:47 +0200 (MET DST) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6N8GkSH026954 for ; Fri, 23 Jul 2004 10:16:46 +0200 Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef.ens.fr (8.12.11/1.01.28121999) with ESMTP id i6N8Gkrn012738 ; Fri, 23 Jul 2004 10:16:46 +0200 (CEST) Received: from localhost (frisch@localhost) by clipper.ens.fr (8.12.3/jb-1.1) id i6N8Gicq014239 ; Fri, 23 Jul 2004 10:16:45 +0200 (MET DST) X-Authentication-Warning: clipper.ens.fr: frisch owned process doing -bs Date: Fri, 23 Jul 2004 10:16:44 +0200 (MET DST) From: Alain Frisch X-X-Sender: frisch@clipper.ens.fr Reply-To: Alain Frisch To: Jon Harrop cc: caml-list Subject: Re: [Caml-list] Hunting polymorphic function applications In-Reply-To: <200407230544.55323.postmaster@jdh30.plus.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.3.3 (nef.ens.fr [129.199.96.32]); Fri, 23 Jul 2004 10:16:46 +0200 (CEST) X-Miltered: at concorde with ID 4100C96E.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; alain:01 frisch:01 alain:01 frisch:01 caml-list:01 asts:01 run-time:01 bool:01 equality:01 int:01 int:01 polymorphic:01 polymorphic:01 assert:02 assert:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 23 Jul 2004, Jon Harrop wrote: > For elegance, I've been using the built-in polymorphic comparisons > (particularly equality) to compare ASTs. I just added some metadata to my AST > type and now it needs its own comparison function (or polymorphic compare > bails at run-time with Invalid_argument "equal: functional value"). > > Is there an easy way, or does anyone have a tool, which will let me track down > all applications of polymorphic functions to my AST type so that I can alter > them to use my customised versions? I sometimes use the following trick: redefine the operators at the beginning of the module. E.g.: let (=) (x:unit) : unit = assert false let (<=) (x:unit) : unit = assert false ... let compare (x:unit) : unit = assert false This should produce type-errors where expected. (Variant: "let (<=) = ((<=) : int -> int -> bool)" to restrict the use to the integer case) -- Alain ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners