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 QAA18758; Fri, 1 Feb 2002 16:12:59 +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 QAA19101 for ; Fri, 1 Feb 2002 16:12:58 +0100 (MET) Received: from CS.UniBO.IT (leporello.cs.unibo.it [130.136.1.110]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g11FCv522536; Fri, 1 Feb 2002 16:12:57 +0100 (MET) Received: from marcello.cs.unibo.it (root@marcello.cs.unibo.it [130.136.2.29]) by CS.UniBO.IT (8.9.3/8.9.3/Debian 8.9.3-6) with ESMTP id QAA25105; Fri, 1 Feb 2002 16:12:56 +0100 Received: (from sacerdot@localhost) by marcello.cs.unibo.it (8.9.3/8.9.3/Debian 8.9.3-21) id QAA05346; Fri, 1 Feb 2002 16:12:56 +0100 Date: Fri, 1 Feb 2002 16:12:56 +0100 From: Claudio Sacerdoti Coen To: Jerome Vouillon Cc: caml-list@inria.fr Subject: Re: [Caml-list] Recursive classes and subtyping Message-ID: <20020201161256.B5286@cs.unibo.it> References: <3C5A8747.BE14426@inrialpes.fr> <20020201143448.A16091@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020201143448.A16091@pauillac.inria.fr>; from jerome.vouillon@inria.fr on Fri, Feb 01, 2002 at 02:34:48PM +0100 X-Operating-System: Debian GNU/Linux X-Organization: Department of computer science, University of Bologna, Eurpean Union 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. >... > If you really need mutually recursive classes, a work-around is to > explicitely define the classe types before defining the classes. I suppose this should be related with this other example (which is the semplification of a problem I have just met): # type -'a t;; type -'a t # class c (obj : [> `A] t) = object end and d (obj : [`A] t) = object method c = new c obj end;; class c : [ `A] t -> object end class d : [ `A] t -> object method c : c end Is there any way to to obtain the type "class c : [> `A] t -> object end" while keeping the mutual recursion? I have tried to explicitely define the class types, but I have had no success at all. Thanks in advance, C.S.C. -- ---------------------------------------------------------------- Real name: Claudio Sacerdoti Coen PhD Student in Computer Science at University of Bologna E-mail: sacerdot@cs.unibo.it http://caristudenti.cs.unibo.it/~sacerdot ---------------------------------------------------------------- ------------------- 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