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 QAA02364; Mon, 18 Aug 2003 16:40:04 +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 QAA05332 for ; Mon, 18 Aug 2003 16:40:03 +0200 (MET DST) Received: from barry.mail.mindspring.net (barry.mail.mindspring.net [207.69.200.25]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h7IEe2f09429 for ; Mon, 18 Aug 2003 16:40:02 +0200 (MET DST) Received: from user-0ccekej.cable.mindspring.com ([24.199.81.211] helo=minsky-primus.homeip.net) by barry.mail.mindspring.net with smtp (Exim 3.33 #1) id 19olAv-0001Z1-00 for caml-list@inria.fr; Mon, 18 Aug 2003 10:40:01 -0400 Received: from 141.155.88.179 (SquirrelMail authenticated user yminsky) by minsky-primus.homeip.net with HTTP; Mon, 18 Aug 2003 10:40:00 -0400 (EDT) Message-ID: <21795.141.155.88.179.1061217600.squirrel@minsky-primus.homeip.net> Date: Mon, 18 Aug 2003 10:40:00 -0400 (EDT) Subject: [Caml-list] Parameterizing multiple modules using functors From: "Yaron Minsky" To: X-Priority: 3 Importance: Normal X-Mailer: SquirrelMail (version 1.2.11) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 cornell:01 functors:01 3.07:01 functor:01 struct:01 genericity:01 signatures:02 modules:02 module:03 explicit:03 awful:03 arguments:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I've asked this question before, but never quite got a satisfactory answer. I'm hoping something has changed between now and then (maybe with 3.07?). Here's the issue. Consider a project consisting of multiple modules with lots of interdependencies. Imagine then that I want to add some flexibility to the system by abstracting out some of the structure of the system using a functor. Thus, I start out with modules A, B, C, and I want to parameterize all these modules, let's say by the same module X. So what I want is a version of the program where I can use A.F(X) intead of A, B.F(X) instead of B, and so on. The problem is that I want to allow references between these modules. Thus, B.F(X) needs access to A.F(X), and C.F(X) needs access to both A.F(X) and B.F(X). The question is, is there a reasonable way to achieve this? I can think of an unreasonable way. I can write the relevant functors so that they can be embedded in a unified module U as follows: module U = struct module A = A.F(X) module B = B.F(A,X) module C = C.F(A,B,X) end In other words, B and C and require in their functors explicit arguments corresponding to the other modulse they need. This works, but it's awfully ugly, not least because you have to write down some awful module signatures in B and C to make this work. Is there any non-awful way to achieve this? The absence of this kind of feature makes the entire functor system seem much less attractive for adding any large-scale genericity. Yaron ------------------- 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