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 QAA11733; Sat, 21 Jun 2003 16:55:05 +0200 (MET DST) 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 QAA12718 for ; Sat, 21 Jun 2003 16:55:04 +0200 (MET DST) Received: from flux.ptc.spbu.ru (flux.ptc.spbu.ru [195.19.225.195]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h5LEt3T01840 for ; Sat, 21 Jun 2003 16:55:03 +0200 (MET DST) Received: from polymorph.punk (polymorph.dorms.spbu.ru [195.19.254.23]) by flux.ptc.spbu.ru (8.11.2/8.11.3/cf-1.1.rbl) with ESMTP id h5LEt2494383 for ; Sat, 21 Jun 2003 18:55:02 +0400 (MSD) (envelope-from asl@polymorph.dorms.spbu.ru) Received: from asl by polymorph.punk with local (Exim 3.35 #1 (Debian)) id 19TjmA-00010h-00 for ; Sat, 21 Jun 2003 18:55:34 +0400 Date: Sat, 21 Jun 2003 18:55:34 +0400 From: Anton Lavrik To: caml-list@inria.fr Subject: [Caml-list] Mutual recursion between classes and types in OCaml Message-ID: <20030621145534.GA3820@polymorph.dorms.spbu.ru> Reply-To: Anton Lavrik Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline X-Spam: no; 0.00; tercom:01 recursion:01 val:01 analogous:01 ocaml:01 afaik:01 int:01 polymorphic:01 classes:03 constructor:03 btw:03 suppose:03 object:03 types:03 mean:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I suppose it's quite useful to define object types and "ordinary" types, so that they could refer to each other. For example, class c = object val v = A 0 (* constructor `A' is not bound *) end [...] (* some syntactic construct like `and' keyword *) type t = A of int | B of c (* now type `t' and constructor `A' are defined *) It is possible to mix these two type definition forms in sequential order. And AFAIK it's not possible to define types like in the example above, at least in direct manner (however one can use polymorphic classes and virtualization to achieve analogous results, but this is very inconvenient in general). So why mutual recursion between classes and types is not allowed? Is this fundamental or technical problem? I can't find any references denoting that problem. BTW, what does `-rectypes' ocamlc's option really mean (there are quite a few words about it in reference manual)? And how does it concern the subject? -- Regards, Anton. ------------------- 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