From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 7CA60BB84 for ; Tue, 10 Feb 2009 18:14:16 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwBAKhEkUnCpx6wmWdsb2JhbACURQEBAQEBCAsKBxG/K4QaBg X-IronPort-AV: E=Sophos;i="4.38,187,1233529200"; d="scan'208";a="22770436" Received: from unknown (HELO min.univ-orleans.fr) ([194.167.30.176]) by mail3-smtp-sop.national.inria.fr with ESMTP; 10 Feb 2009 18:14:16 +0100 Received: from smtps.univ-orleans.fr (localhost [127.0.0.1]) by min.univ-orleans.fr (Postfix) with ESMTP id C6CF912B520 for ; Tue, 10 Feb 2009 18:14:13 +0100 (CET) Received: from [192.168.0.1] (lau18-1-82-246-197-195.fbx.proxad.net [82.246.197.195]) by smtps.univ-orleans.fr (Postfix) with ESMTP id C814036E60 for ; Tue, 10 Feb 2009 18:14:16 +0100 (CET) Subject: Hiding private types From: David Rajchenbach-Teller To: OCaml Content-Type: text/plain; charset=UTF-8 Date: Tue, 10 Feb 2009 18:14:26 +0100 Message-Id: <1234286066.6457.35.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; ens-lyon:01 leaking:01 dependencies:01 toplevel:01 toplevel:01 univ-orleans:01 lifo:01 defines:01 define:02 define:02 modules:02 defined:02 output:02 output:02 string:02 Dear list, I'm looking for a way to remove one or two annoyances of Batteries, which are related to private magic leaking into the type system and into the documentation. We define a module [IO] with, among other things, a type [output]. In fact, in order to avoid circular dependencies, [output] is actually defined in a private module [InnerIO], which lets other modules such as [ExtString] use [output] and still be used by [IO]. For instance, [ExtString] defines a function [print : InnerIO.output -> string -> unit]. At a later stage, we pack [IO], [InnerIO], [ExtString] and others into a module [Extlib] and we later define a module [Batteries] containing module IO = Extlib.IO module String = ExtString.String etc. Now, all of this works. Unfortunately, the types visible by the user, either from the toplevel, from error messages or from -dannot, reveal too much from the inner workings of Batteries. For instance, [InnerIO], as implied by the name, is private. The existence of this module should not be visible by the user. Unfortunately, on the toplevel, we have # String.print;; - : Extlib.InnerIO.output -> string -> unit = Two abstractions have leaked out: * the existence of [InnerIO] * the existence of [Extlib] I would rather have # String.print;; - : IO.output -> string -> unit = or, at worst # String.print;; - : Batteries.IO.output -> string -> unit = Does anyone have an idea of how we could/should do this? Thanks, David -- David Teller-Rajchenbach Security of Distributed Systems http://www.univ-orleans.fr/lifo/Members/David.Teller « Ce matin Un crétin A tué un chercheur. » (air connu) Latest News of French Research: System being liquidated. Researchers angry.