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 RAA01200; Thu, 5 Aug 2004 17:10:09 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 RAA00998 for ; Thu, 5 Aug 2004 17:10:08 +0200 (MET DST) Received: from relaissmtp.ens-lyon.fr (pluvier.ens-lyon.fr [140.77.167.5]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i75FA7RM018753 for ; Thu, 5 Aug 2004 17:10:07 +0200 Received: from mouette.ens-lyon.fr ([140.77.167.4]) by relaissmtp.ens-lyon.fr with esmtp (Exim 3.35 #1 (Debian)) id 1Bsjsc-00052L-00; Thu, 05 Aug 2004 17:10:06 +0200 Received: by mouette.ens-lyon.fr (Postfix, from userid 33) id 3A5BD3C61C2; Thu, 5 Aug 2004 17:10:06 +0200 (CEST) To: Ross Duncan Subject: Re: [Caml-list] Conditional Modules Message-ID: <1091718606.41124dce16939@mouette.ens-lyon.fr> Date: Thu, 05 Aug 2004 17:10:06 +0200 (CEST) From: Jean-Baptiste Rouquier Cc: caml-list@pauillac.inria.fr References: <20040804160247.GA13965@annexia.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.6 X-Originating-IP: 68.40.185.95 X-Miltered: at concorde with ID 41124DCF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 ens-lyon:01 runtime:01 runtime:01 struct:01 argv:01 printf:01 eprintf:01 sig:01 int:01 match:02 modules:02 module:03 module:03 string:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Ross Duncan wrote: > module type T = > sig > type t > (* some other stuff involving t *) > end > > module M1 : T = .... > module M2 : T = .... > > (* and now choose at runtime between M1 and M2 *) > > It seems that all the *other stuff* can be chosen at runtime with various degrees of elegance but the type t is the big spanner which stops the machine. Is the following what you need ? module F (M:T) = struct let main () = ... end let () = match int_of_string Sys.argv.(1) with | 1 -> let module A = F(M1) in A.main () | 2 -> let module A = F(M2) in A.main () | _ -> Printf.eprintf ... Jean-Baptiste. ------------------- 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