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 OAA17259; Fri, 1 Feb 2002 14:42:42 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 OAA17265 for ; Fri, 1 Feb 2002 14:42:41 +0100 (MET) Received: from ebene.inrialpes.fr (ebene.inrialpes.fr [194.199.18.70]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g11Dge518564; Fri, 1 Feb 2002 14:42:41 +0100 (MET) Received: from pop-serv.inrialpes.fr (pop-serv.inrialpes.fr [194.199.18.66]) by ebene.inrialpes.fr (8.11.6/8.11.6) with ESMTP id g11DgQJ16446; Fri, 1 Feb 2002 14:42:26 +0100 (MET) Received: from inrialpes.fr (cime.inrialpes.fr [194.199.23.76]) by pop-serv.inrialpes.fr (8.10.2+Sun/8.11.3/ImagV2) with ESMTP id g11DgPK02777; Fri, 1 Feb 2002 14:42:25 +0100 (MET) Message-ID: <3C5A9B41.517DDC1B@inrialpes.fr> Date: Fri, 01 Feb 2002 14:42:25 +0100 From: Frederic Tronel X-Mailer: Mozilla 4.76 [en] (X11; U; SunOS 5.8 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Jerome Vouillon , caml-list@inria.fr Subject: Re: [Caml-list] Recursive classes and subtyping References: <3C5A8747.BE14426@inrialpes.fr> <20020201143448.A16091@pauillac.inria.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > In the first case, the type "a" is not fully known when the coercion > "(c :> a)" is performed, as the classes are mutually recursive. The > compiler handles this case as if it knew nothing about the structure > of the type "a". With this assumption, the only case the compiler can > be sure that the type of "c" is a subtype of "a" is when the type of > "c" is "a". This is not the case, hence the error message. > > The reason for this overly conservative (in this case) assumption is > that the result of the type inference algorithm could otherwise depend > on the order in which the program is typed. > Clear ! > If you really need mutually recursive classes, a work-around is to > explicitely define the classe types before defining the classes. > I don't really need recursive classes, but I started writing my classes in a top-down manner with forward references to classes to be defined. Hence, the use of recursive classes. I can simply change my definitions order (bottow-up), it solves the problem ! Thanks, Frederic. ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr