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 TAA19808; Wed, 4 Aug 2004 19:23:03 +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 TAA19066 for ; Wed, 4 Aug 2004 19:23:02 +0200 (MET DST) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.207]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i74HN0RM029285 for ; Wed, 4 Aug 2004 19:23:01 +0200 Received: by mproxy.gmail.com with SMTP id 76so204465rnl for ; Wed, 04 Aug 2004 10:23:00 -0700 (PDT) Received: by 10.38.171.1 with SMTP id t1mr82485rne; Wed, 04 Aug 2004 10:23:00 -0700 (PDT) Message-ID: Date: Wed, 4 Aug 2004 10:23:00 -0700 From: henri dubois-ferriere To: Ross Duncan Subject: Re: [Caml-list] Conditional Modules Cc: caml-list@pauillac.inria.fr In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: X-Miltered: at concorde with ID 41111B74.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; henridf:01 caml-list:01 2004:99 functor:01 bug:01 faq:01 faq:01 beginner's:01 beginners:01 bin:01 caml-bugs:01 ocaml:01 ocaml:01 caml:01 caml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk this isn't possible, because modules are not first class values. there was a thread on this with some examples of how to get around it: http://caml.inria.fr/archives/200209/msg00317.html henri On Wed, 4 Aug 2004 15:58:50 +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. > > 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 > ------------------- 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