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 RAA20832; Fri, 1 Feb 2002 17:42:02 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA20144 for ; Fri, 1 Feb 2002 17:42:01 +0100 (MET) Received: from feu.irisa.fr (feu.irisa.fr [131.254.60.80]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g11Gg0v04936 for ; Fri, 1 Feb 2002 17:42:00 +0100 (MET) Received: from lawson.irisa.fr (lawson.irisa.fr [131.254.12.46]) by feu.irisa.fr (8.11.4/8.11.4) with ESMTP id g11Gfxt07157; Fri, 1 Feb 2002 17:41:59 +0100 (MET) Date: Fri, 1 Feb 2002 17:41:59 +0100 (MET) From: Laurent Vibert To: Claudio Sacerdoti Coen cc: caml-list@inria.fr Subject: Re: [Caml-list] Recursive classes and subtyping In-Reply-To: <20020201161256.B5286@cs.unibo.it> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 1 Feb 2002, Claudio Sacerdoti Coen wrote: > # 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 think this is more or less related to http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#regle_mu so you could write : class c (obj : [> `A] t) = object end and d' (newc : [ `A] t -> c) (obj : [`A] t) = object method c = newc obj end;; class d obj = object inherit d' (new c) obj end;; -- Laurent Vibert doctorant, équipe Espresso IRISA-INRIA, Campus de Beaulieu Tél: +33 (0) 2 99 84 72 33 35042 Rennes Cedex, France Fax: +33 (0) 2 99 84 71 71 ------------------- 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