From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id F36A8D45F for ; Wed, 2 Nov 2005 15:02:34 +0100 (CET) Received: from postman.medtronic.com (postman.medtronic.COM [144.15.157.121]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jA2E2XUS019840 for ; Wed, 2 Nov 2005 15:02:34 +0100 Received: from bishop.pace.medtronic.COM (localhost [127.0.0.1]) by postman.medtronic.com (8.12.9/8.12.9) with ESMTP id jA2E2TYC008352 for ; Wed, 2 Nov 2005 08:02:29 -0600 (CST) Received: from pace.medtronic.com. (nenya.pace.medtronic.COM [144.15.20.58]) by bishop.pace.medtronic.COM (8.9.1b+Sun/8.9.1) with ESMTP id IAA05172 for ; Wed, 2 Nov 2005 08:02:28 -0600 (CST) Received: from [127.0.0.1] (IDENT:U2FsdGVkX1/rHy9F/4/tGJpfIVOBAwPqiCUeX/nj46c@localhost [127.0.0.1]) by pace.medtronic.com. (8.12.11/8.12.11) with ESMTP id jA2E2SCw011649 for ; Wed, 2 Nov 2005 08:02:28 -0600 Message-ID: <4368C6F4.6050301@confluent.org> Date: Wed, 02 Nov 2005 08:02:28 -0600 From: Tom Hawkins User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Nesting Modules References: <43679EEF.70102@confluent.org> <20051102094613.GA8506@furbychan.cocan.org> <4368AA08.8030409@confluent.org> <20051102.141108.60891081.Christophe.Troestler@umh.ac.be> In-Reply-To: <20051102.141108.60891081.Christophe.Troestler@umh.ac.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4368C6F9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 nesting:01 mli:01 pairs:01 mli:01 'let:01 'let:01 ocamlc:01 ocamlc:01 cmo:01 cmo:01 cmi:01 cmi:01 ocaml:01 ...:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 I found a convenient way to compose a set modules into a hierarchical library. First define the set of modules (ml/mli file pairs) -- these become the leaves in the module tree. Next, define the branch modules in the hierarchy using "module Leaf = Leaf" (ml only, no mli). Then compile and link. The only restriction is that all functional code must reside in leaf modules. Here's an example... # Define the leaf modules. echo 'let name = "leaf1"' > leaf1.ml echo 'val name : string' > leaf1.mli echo 'let name = "leaf2"' > leaf2.ml echo 'val name : string' > leaf2.mli echo 'let name = "leaf3"' > leaf3.ml echo 'val name : string' > leaf3.mli # Define the branch modules. echo 'module Leaf2 = Leaf2;; module Leaf3 = Leaf3' > branch2.ml echo 'module Leaf1 = Leaf1;; module Branch2 = Branch2' > branch1.ml # Compile all leaf modules. ocamlc -c leaf1.mli ocamlc -c leaf1.ml ocamlc -c leaf2.mli ocamlc -c leaf2.ml ocamlc -c leaf3.mli ocamlc -c leaf3.ml # Compile all branch modules. ocamlc -c branch2.ml ocamlc -c branch1.ml # Link the library. ocamlc -a -o branch1.cma leaf1.cmo leaf2.cmo leaf3.cmo branch2.cmo branch1.cmo # Delete all *.cmi files except top. rm leaf*.cmi rm branch2.cmi # Run. ocaml branch1.cma Objective Caml version 3.09.0 # Branch1.Branch2.Leaf3.name;; - : string = "leaf3" Thanks for everyone's help! -Tom