From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA19377 for caml-redistribution; Tue, 22 Jul 1997 18:28:14 +0200 (MET DST) 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 QAA16771 for ; Tue, 22 Jul 1997 16:19:37 +0200 (MET DST) Received: from simon.cs.cornell.edu (SIMON.CS.CORNELL.EDU [128.84.154.10]) by concorde.inria.fr (8.8.5/8.8.5) with ESMTP id QAA17622 for ; Tue, 22 Jul 1997 16:19:32 +0200 (MET DST) Received: from cloyd.cs.cornell.edu (CLOYD.CS.CORNELL.EDU [128.84.227.15]) by simon.cs.cornell.edu (8.8.5/8.8.5/R-1.8) with ESMTP id KAA17126 for ; Tue, 22 Jul 1997 10:19:26 -0400 (EDT) Received: from mario.cs.cornell.edu (MARIO.CS.CORNELL.EDU [128.84.254.142]) by cloyd.cs.cornell.edu (8.8.5/8.8.5/M-1.9) with ESMTP id KAA20202 for ; Tue, 22 Jul 1997 10:19:24 -0400 (EDT) Received: (from stodghil@localhost) by mario.cs.cornell.edu (8.8.5/8.8.5/C-1.2) id KAA15057; Tue, 22 Jul 1997 10:19:21 -0400 (EDT) To: caml-list@pauillac.inria.fr Subject: Managing module names Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII From: Paul Stodghill Date: 22 Jul 1997 10:19:21 -0400 Message-ID: X-Mailer: Gnus v5.4.63/XEmacs 19.15 Sender: weis This is the message that I am going to send to Jason, Mark, and the Caml mailing list. What do you think? One of the things that modules in O'Caml can be used for is to prevent namespace pollution. That is, functions and times encapsulated within modules can be given names without fear that those names will conflict with names in other modules. But, how does one prevent pollution in the module namespace? As near as I can tell, there are two ways to address this problem: 1) Carefully choose the names of the .ml and .mli files that will contain each of the top-level modules. E.g., Project_util, Project_expr, Project_toplevel The advantage of this approach is that each of these modules can go into its own source file and each can be compiled seperately. The disadvantage is that the module names tend to be longer, or less intuitive. 2) Enclose all of the "top-level" modules within a single "Project" module. E.g., Project.Util, Project.Expr, Project.Toplevel The advantage is that the names of the modules that are visible to the user of the Project module are more "rational", and the simpler names of the modules can be used simply by openning the Project module. The disadvantage seems to be that this requires some contortions in order to get this to work: Project.mli: module Util = Project_util module Expr = Project_expr module Toplevel = Project_toplevel Project_util.ml: (* implementation of the Project.Util module *) Project_expr.ml: (* implementation of Project.Expr module *) open Project_expr (* <- Yuck! *) ... Here is my question: Are there other approach that people have used to managing module name space pollution in O'Caml? Thanks in advance. -- Paul Stodghill http://www.cs.cornell.edu/home/stodghil/home.html