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 SAA15873; Wed, 4 Aug 2004 18:02:49 +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 SAA15997 for ; Wed, 4 Aug 2004 18:02:49 +0200 (MET DST) Received: from annexia.force9.co.uk (annexia.force9.co.uk [212.56.101.183]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i74G2mmL028766 for ; Wed, 4 Aug 2004 18:02:48 +0200 Received: from rich by annexia.force9.co.uk with local (Exim 3.36 #1 (Debian)) id 1BsOE3-0003eZ-00 for ; Wed, 04 Aug 2004 17:02:47 +0100 Date: Wed, 4 Aug 2004 17:02:47 +0100 Cc: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] Conditional Modules Message-ID: <20040804160247.GA13965@annexia.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at nez-perce with ID 411108A8.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 2004:99 functor:01 camlp:01 camlp:01 crm:99 consultancy:99 ltd:98 ifdef:01 cmo:01 ocaml:01 caml:01 command:98 compile:02 modules:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Aug 04, 2004 at 03:58:50PM +0100, Ross Duncan wrote: > 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. I suspect that the only way to do it would be with pa_macro.cmo (part of Camlp4). This means it would be done at compile time, which is probably not what you wanted. http://caml.inria.fr/camlp4/manual/manual002.html#toc1 (BTW: What is the difference between pa_macro and pa_ifdef? I have both on my system, and they appear to do much the same thing.) Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment http://www.winwinsales.co.uk/ - CRM improvement consultancy ------------------- 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