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 QAA19013; Wed, 4 Aug 2004 16:58:53 +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 QAA12489 for ; Wed, 4 Aug 2004 16:58:52 +0200 (MET DST) Received: from tx3.oucs.ox.ac.uk (tx3.oucs.ox.ac.uk [163.1.2.167]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i74EwpmL020599 for ; Wed, 4 Aug 2004 16:58:51 +0200 Received: from scan3.oucs.ox.ac.uk ([163.1.2.166] helo=localhost) by tx3.oucs.ox.ac.uk with esmtp (Exim 4.24) id 1BsNEB-0005Ds-O3 for caml-list@pauillac.inria.fr; Wed, 04 Aug 2004 15:58:51 +0100 Received: from rx3.oucs.ox.ac.uk ([163.1.2.165]) by localhost (scan3.oucs.ox.ac.uk [163.1.2.166]) (amavisd-new, port 25) with ESMTP id 19932-02 for ; Wed, 4 Aug 2004 15:58:51 +0100 (BST) Received: from smtp1.herald.ox.ac.uk ([163.1.0.247]) by rx3.oucs.ox.ac.uk with esmtp (Exim 4.24) id 1BsNEB-0005Dp-Am for caml-list@pauillac.inria.fr; Wed, 04 Aug 2004 15:58:51 +0100 Received: from dhcpa9.comlab.ox.ac.uk ([163.1.27.209]) by smtp1.herald.ox.ac.uk with esmtp (Exim 3.35 #1) id 1BsNEB-0006Kk-3z for caml-list@pauillac.inria.fr; Wed, 04 Aug 2004 15:58:51 +0100 Mime-Version: 1.0 (Apple Message framework v618) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; format=flowed To: caml-list@pauillac.inria.fr From: Ross Duncan Subject: [Caml-list] Conditional Modules Date: Wed, 4 Aug 2004 15:58:50 +0100 X-Mailer: Apple Mail (2.618) X-Miltered: at nez-perce with ID 4110F9AB.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; functor:01 ocaml:01 ocaml:01 command:98 behaviour:01 syntax:02 modules:02 modules:02 module:03 module:03 clues:04 seems:05 define:05 arg:06 arg:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Forgive me for asking what might be an easy question, I am just a beginner with Ocaml. I want to do something like this: module M = if arg then M1 else M2 module A = F (M) (* define rest of program using fields of A *) The idea being that arg will come from e.g. the command line, and modules M1, M2 and functor F are defined elsewhere. Of course "module M = if ... " is a syntax error. My question is: how to achieve this behaviour (and generalisations of it) in ocaml? It seems that this is an obvious thing to want to do but I haven't found any clues in the manual or the FAQs. Is it me? -r ------------------- 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