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 317A4BB81 for ; Tue, 7 Dec 2004 03:26:58 +0100 (CET) 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 iB72Qvg1015952 for ; Tue, 7 Dec 2004 03:26:57 +0100 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 DAA04564 for ; Tue, 7 Dec 2004 03:26:57 +0100 (MET) Received: from lion.seas.upenn.edu (LION.SEAS.upenn.edu [158.130.12.194]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iB72QufD015949 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 7 Dec 2004 03:26:57 +0100 Received: from [192.168.2.101] (dhcp0567.grt.resnet.group.upenn.edu [165.123.142.195]) (authenticated bits=0) by lion.seas.upenn.edu (8.12.10/8.12.10) with ESMTP id iB72Qs6B001173 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Mon, 6 Dec 2004 21:26:55 -0500 Message-ID: <41B514EB.7030707@cis.upenn.edu> Date: Mon, 06 Dec 2004 21:26:51 -0500 From: Aaron Bohannon User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Caml List Subject: exceptions in recursive modules Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41B514F1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41B514F0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; upenn:01 recursive:01 recursive:01 debugging:01 intuitively:01 bug:01 rec:01 sig:01 val:01 struct:01 rec:01 elt:01 val:01 abstr:01 ocaml:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: I was trying to use a recursive module but was getting unexpected "Undefined_recursive_modules" exceptions. After a long debugging session, I discovered the source of my problem to be exception declarations in the module. I don't intuitively understand why they cause a problem, and as I cannot find documentation of the behavior, I am wondering if it might be a bug. Here is the example. This is essentially the example in the manual, but I have added an exception to the module: module rec A : sig type t = Leaf of int | Node of ASet.t exception Fail val compare : t -> t -> int end = struct type t = Leaf of int | Node of ASet.t exception Fail let rec compare = (* suitable definition *) end and ASet : Set.S with type elt = A.t = Set.Make(A) Then we can try to use it: # let x = A.Leaf(3);; val x : A.t = A.Leaf 3 # let s = ASet.add x ASet.empty;; val s : ASet.t = # let s' = ASet.add x s;; Exception: Undefined_recursive_module ("recmodtest.ml", 6, 6). If we remove the "exception Fail" from the signature, everything works just fine. Is this behavior correct? (I am using OCaml 3.08.1) Aaron -- Aaron Bohannon http://www.cis.upenn.edu/~bohannon/