From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id OAA11252 for caml-redistribution; Mon, 1 Apr 1996 14:04:14 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id PAA13337 for ; Fri, 29 Mar 1996 15:10:51 +0100 From: pbrisset@eis.enac.dgac.fr Received: from margaux.inria.fr (margaux.inria.fr [128.93.8.2]) by concorde.inria.fr (8.7.1/8.7.1) with ESMTP id PAA02854 for ; Fri, 29 Mar 1996 15:10:29 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by margaux.inria.fr (8.6.10/8.6.6) with ESMTP id PAA28839 for ; Fri, 29 Mar 1996 15:10:50 +0100 Received: from apollo12.eis.enac.dgac.fr (apollo12.eis.enac.dgac.fr [192.70.3.82]) by concorde.inria.fr (8.7.1/8.7.1) with SMTP id PAA02850 for ; Fri, 29 Mar 1996 15:10:27 +0100 (MET) Message-Id: <199603291410.PAA02850@concorde.inria.fr> Received: from apoge.eis.enac.dgac.fr by apollo12.eis.enac.dgac.fr with SMTP (1.37.109.4/17.1) id AA08814; Fri, 29 Mar 96 15:10:45 +0100 Received: by apoge.eis.enac.dgac.fr (1.38.193.4/16.2) id AA10154; Fri, 29 Mar 1996 15:10:46 +0100 Date: Fri, 29 Mar 1996 15:10:46 +0100 To: caml-list@margaux.inria.fr Subject: Re: One more question about the module system Sender: weis ... > (* m1.ml *) > module Make(L: MTYPE_L)(Some_M2: MTYPE_M2) = struct > open L > open Some_M2 > ... > end > (* m.ml *) > module Make(L: MTYPE_L)(Some_M1: MTYPE_M1) = struct > open L > open Some_M1 > ... > end > > (You will probably need to express sharing constraints between type > components of the parameters. Express them with "with type" or > "with module", e.g. > module Make(L: MTYPE_L)(Some_M2: MTYPE_M2 with type t = L.t) ... > ) > > Then do all the functor applications in a "main" file: > > module L = L1 (* or L2 *) > module M2 = M2.Make(L) > module M1 = M1.Make(L)(M2) > module M = M.Make(L)(M1) > > The advantage of this approach is that you can also provide > "hand-made" M1 or M2 modules (not produced by application of M1.Make > or M2.Make), so you get more flexibility. The disadvantage is > increased verbosity and number of declarations needed. > > - Xavier Leroy I eventually found the same solution. Because I wanted a single "big" module, I wrote: (* m.ml *) module Make(L: SIG_L) = struct module M2 = M2.Make(L) open M2 module M1 = M1.Make(L, M2) open M1 ... I also checked that runtime efficiency is not modified by all these functorizations. --Pascal