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 QAA01264; Mon, 12 Aug 2002 16:16:08 +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 QAA01260 for ; Mon, 12 Aug 2002 16:16:07 +0200 (MET DST) Received: from rashko.ilt.kharkov.ua (as5300.kharkov.ukrtel.net [195.5.1.188]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id g7CEG4X06187 for ; Mon, 12 Aug 2002 16:16:05 +0200 (MET DST) From: "Yurii A. Rashkovskii" Reply-To: yrashk@openeas.org To: caml-list@inria.fr Subject: [Caml-list] Namespace proposal Date: Mon, 12 Aug 2002 17:19:15 +0300 X-Mailer: KMail [version 1.1.99] Content-Type: text/plain; charset="koi8r" MIME-Version: 1.0 Message-Id: <02081217191500.26326@rashko.ilt.kharkov.ua> Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I'd like to submit a proposal for OCaml namespaces. Any questions, reports about my mistakes and so on are welcome :) OCaml Namespace Proposal ======================== Version: 0.1 (DRAFT) 1. What Is a Namespace? ======================= Namespace is an approach to assemble all components used for development in way that will prevent name coincidence. 2. Syntax ========= Namespace support will add new reserved keyword 'namespace' that will be used in way indentical to 'module', except that namespaces could not be parametrized (no polymorphism allowed). Namespace will not be module replacement. Example: namespace Org = struct namespace Openeas = struct namespace Core = struct ... end end end The above example creates Org, Org.Openeas and Org.Openeas.Core namespaces. 4. How It Works? ================ To solve the positing problem (preventing name coincidence) namespaces are subject to be "glued". This means that in case of coincidence of names namespaces' signatures and structures are glued in two new single one signature and structure. Example: namespace Org = struct namespace Openeas = struct namespace Core = struct let f x = x end end end namespace Org = struct namespace Openeas = struct namespace Misc = struct let j x = x end end end The above example will define namespaces Org.Openeas.Core and Org.Openeas.Misc with some functions inside. There we'll get the first benefit - we could define namespaces absolutely independing with coincident names and this will make no harm for the development. The next benefit is that we could add functions and objects to existing namespace wherever. Since OCaml is a language that pretends to be fully adopted for the "real world" programming, namespaces will add the possibility to construct applications in a more clean way. 5. Some Considerations ====================== In order to make namespaces' implementation easier it is proposed to "glue" namespace structures and signatures only on opening modules that contain namespace(s). So, for instance, we have module HTTP_Library that contains Org.W3.HTTP namespace defined and module FTP_Library that contains Net.Sourceforge.CamlFtp namespace defined. (* Here is no Org.W3.HTTP namespace *) open HTTP_Library;; (* Here Org.W3.HTTP namespace is available *) (* but no Net.Sourceforge.CamlFtp *) open FTP_Library;; (* And here Net.Sourceforge.CamlFtp is available *) -- Regards, Yurii ------------------- 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