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 WAA12042; Tue, 30 Dec 2003 22:06:41 +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 WAA13207 for ; Tue, 30 Dec 2003 22:06:40 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from gadolinium.btinternet.com (gadolinium.btinternet.com [194.73.73.111]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hBUL6dv14795 for ; Tue, 30 Dec 2003 22:06:39 +0100 (MET) Received: from [81.128.10.227] (helo=beertje.william.bogus) by gadolinium.btinternet.com with esmtp (Exim 3.22 #25) id 1AbR4V-0005G7-00 for caml-list@inria.fr; Tue, 30 Dec 2003 21:06:35 +0000 Received: by beertje.william.bogus (Postfix, from userid 501) id ABA5C96BAB; Tue, 30 Dec 2003 21:02:29 +0000 (GMT) From: William Chesters To: caml-list@inria.fr Subject: [Caml-list] Recursive class types (long-standing question ...) Message-Id: <20031230210229.ABA5C96BAB@beertje.william.bogus> Date: Tue, 30 Dec 2003 21:02:29 +0000 (GMT) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; chesters:01 williamc:01 paneris:01 struct:01 workarounds:01 bool:01 bool:01 int:01 int:01 compile:02 harder:02 classes:03 recursive:03 recursive:03 object:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Here's something I've wondered about for a while and just encountered again. How come this class .. class virtual ['a] c = object method virtual b: bool c end ... gets a constraint 'a = bool? I.e. for instance this doesn't compile: class virtual ['a] c = object method virtual b: bool c method virtual i: int c (* "This type int should be an instance of type bool" *) end Note that the following does work in C++: template struct c { virtual c b() = 0; virtual c i() = 0; }; I guess there are workarounds but it seems unnecessary that ML should find recursive parameterised classes harder than C++? ------------------- 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