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 KAA12794 for caml-redistribution; Mon, 25 Mar 1996 10:18:34 +0100 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 NAA11310 for ; Thu, 21 Mar 1996 13:08:47 +0100 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 NAA07235 for ; Thu, 21 Mar 1996 13:08:27 +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 NAA03887 for ; Thu, 21 Mar 1996 13:08:46 +0100 Received: from lasmea.univ-bpclermont.fr (lasmea.univ-bpclermont.fr [193.54.50.15]) by concorde.inria.fr (8.7.1/8.7.1) with ESMTP id NAA07231 for ; Thu, 21 Mar 1996 13:08:25 +0100 (MET) Message-Id: <199603211208.NAA07231@concorde.inria.fr> Received: by lasmea.univ-bpclermont.fr (1.37.109.16/16.2) id AA293980216; Thu, 21 Mar 1996 13:10:17 +0100 From: Jocelyn Serot Subject: Q: Q: Module system and separate compilatioQ: To: caml-list@margaux.inria.fr Date: Thu, 21 Mar 1996 13:10:16 MET X-Mailer: Elm [revision: 109.14] Sender: weis Hello, First of all, thanks to W. Lux and C. Boos for their clever answers to my last questions about the interaction between the module system and the file system. What i had not realized - it seems - is that the module language is _implicitely_ spoken within the file system and that functor application takes place automatically during the linking phase. There seems to be a situation where _explicit_ functor application is useful: when you have defined two distincts implementation for module Foo (both matching the signature defined in foo.mli). With the "all in same file, with explicit module declaration" approach , you can write: module type Bar = sig ... end module type Foo = sig ... end module Foo1 : Foo = struct ... (* 1st impl *) ... end module Foo2 : Foo = struct ... (* Another impl *) ... end module MakeBar(M: Foo) = (struct ... let double = ... Foo.add ... end : Bar) and then _choose_ to build a Bar implementation using either Foo1 module Bar = MakeBar(Foo1) or Foo2 module Bar = MakeBar(Foo2) How can you translate the same approach with the signatures and implementations for Foo and Bar being in distinct files (that is: foo.mli, foo1.ml, foo2.ml, bar.mli and bar.ml) ? It seems that you have to copy foo.mli to foo1.mli and foo2.mli to express that these implementations both match the signature required by Bar. But then, you have to recompile bar.ml, replacing all occurence of Foo.member by Foo1.member or Foo2.member. In other words, there seems to be no way of choosing the Foo implementation at link-time.. Am i right or still missing the point ?... :-) Thanks again for you patience.. -- E-mail: Jocelyn.Serot@lasmea.univ-bpclermont.fr ............................. S-mail: LASMEA - URA 1793 CNRS, Universite Blaise Pascal, 63177 Aubiere cedex Tel: (33) 73.40.73.30 - Fax: (33) 73.40.72.62 ............................... .... http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/Welcome.html