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 XAA21789; Sat, 3 Aug 2002 23:26:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA21721 for caml-list@pauillac.inria.fr; Sat, 3 Aug 2002 23:26:06 +0200 (MET DST) 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 TAA05070 for ; Fri, 2 Aug 2002 19:19:18 +0200 (MET DST) Received: from wptx49.physik.uni-wuerzburg.de (wptx49.physik.uni-wuerzburg.de [132.187.40.49]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g72HJH516880 for ; Fri, 2 Aug 2002 19:19:17 +0200 (MET DST) Received: from wptx47.physik.uni-wuerzburg.de (wptx47.physik.uni-wuerzburg.de [132.187.40.47]) by wptx49.physik.uni-wuerzburg.de (8.10.0/8.10.0.Beta6) with ESMTP id g72HJGj27565; Fri, 2 Aug 2002 19:19:17 +0200 (METDST) Received: (from ohl@localhost) by wptx47.physik.uni-wuerzburg.de (8.10.0.Beta12/8.10.0.Beta12) id g72HJGA01453; Fri, 2 Aug 2002 19:19:16 +0200 From: Thorsten Ohl Message-ID: <15690.48916.704957.774489@wptx47.physik.uni-wuerzburg.de> Date: Fri, 2 Aug 2002 19:19:16 +0200 To: caml-list@inria.fr Subject: [Caml-list] Creating mutually dependent objects? X-Mailer: VM 6.84 under Emacs 20.7.1 Reply-To: ohl@physik.uni-wuerzburg.de Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I need to create tuples of mutually dependent objects. A working implementation adds a mutable instance variable that is updated after all objects in a tuple have been created. With a little bit of work, this variable can then be hidden. However, this is a bit tedious. Why is the much more elegant approach using `let rec' forbidden? # class o n o' = object (_ : 'a) method o' : 'a = o' method n : int = n end;; class o : int -> 'a -> object ('a) method n : int method o' : 'a end # let rec o1 = new o 1 o2 and o2 = new o 2 o1;; Characters 13-23: let rec o1 = new o 1 o2 and o2 = new o 2 o1;; ^^^^^^^^^^ This kind of expression is not allowed as right-hand side of `let rec' Is there a chance that this restriction will be lifted or would such permissiveness undermine type safety? -- Thorsten Ohl, Physics Dept., Wuerzburg Univ. -- ohl@physik.uni-wuerzburg.de http://theorie.physik.uni-wuerzburg.de/~ohl/ [<=== PGP public key here] ------------------- 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