From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA32131 for caml-redistribution; Sat, 9 Jan 1999 23:24:20 +0100 (MET) 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 VAA17890 for ; Sat, 9 Jan 1999 21:24:49 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id VAA12458 for ; Sat, 9 Jan 1999 21:24:48 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id VAA15046 for caml-list@inria.fr; Sat, 9 Jan 1999 21:24:39 +0100 (MET) From: Markus Mottl Message-Id: <199901092024.VAA15046@miss.wu-wien.ac.at> Subject: Using modules and classes recursively To: caml-list@inria.fr (OCAML) Date: Sat, 9 Jan 1999 21:24:39 +0100 (MET) X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: weis Hello - Bonjour, Even though I have tried hard, I couldn't solve the following problem: I want to have a class that is able to return a set of objects of its type, but I have no idea, how I have to formulate this (if it is possible). E.g.: --------------------------------------------------------------------------- class foo = object method bar = FooSet.singleton (new foo) end --------------------------------------------------------------------------- An object of this class would return a set containing itself if its member function "bar" is called. Before the definition of this class, the module "FooSet" has to be created. But it seems impossible to do so. E.g.: --------------------------------------------------------------------------- module FooSet = Set.Make (struct type t = let compare = compare end) --------------------------------------------------------------------------- This does not work, because the type constructor "FooSet.t" cannot be bound before "FooSet" exists - but that's what are defining! Is it impossible to have modules and classes combined recursively? If yes, what would be a good workaround? Best regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl