Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Conditional Modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Conditional Modules
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