From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 9172E7FA5E for ; Wed, 10 May 2017 14:43:20 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=daniel.buenzli@erratique.ch; spf=None smtp.mailfrom=daniel.buenzli@erratique.ch; spf=None smtp.helo=postmaster@smtp.webfaction.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of daniel.buenzli@erratique.ch) identity=pra; client-ip=74.55.86.74; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="daniel.buenzli@erratique.ch"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of daniel.buenzli@erratique.ch) identity=mailfrom; client-ip=74.55.86.74; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="daniel.buenzli@erratique.ch"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp.webfaction.com) identity=helo; client-ip=74.55.86.74; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="postmaster@smtp.webfaction.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AHiOkzB1Wix6kTvbpsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?seIWLfad9pjvdHbS+e9qxAeQG96Kt7Qc06L/iOPJYSQ4+5GPsXQPItRndiQuro?= =?us-ascii?q?EopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZv?= =?us-ascii?q?JuTyB4Xek9m72/q89pDXbAhEniaxba9vJxiqsAv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X2yCf?= =?us-ascii?q?FvrgonAZ6rWN+QDrumh6aMiWLiRsVb?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DLAwC5CRNZaUpWN0pdGwEBAQMBAQEJA?= =?us-ascii?q?QEBFgEBAQMBAQEJAQEBgn+BDQOBCYNpiwuQY5gBJIYAAoU+FQEBAQEBAQEBAQE?= =?us-ascii?q?BEgsLCwgVETGCMyIBgkABBSNWEAsOCgICJgICRxAGGxOKBgSyRoIminUBAQEHA?= =?us-ascii?q?gElgQuKTYQzgz4vgjEBBJAijWh5hiOWcRCGaZRDNYEsgUuGd3SJGQEBAQ?= X-IPAS-Result: =?us-ascii?q?A0DLAwC5CRNZaUpWN0pdGwEBAQMBAQEJAQEBFgEBAQMBAQE?= =?us-ascii?q?JAQEBgn+BDQOBCYNpiwuQY5gBJIYAAoU+FQEBAQEBAQEBAQEBEgsLCwgVETGCM?= =?us-ascii?q?yIBgkABBSNWEAsOCgICJgICRxAGGxOKBgSyRoIminUBAQEHAgElgQuKTYQzgz4?= =?us-ascii?q?vgjEBBJAijWh5hiOWcRCGaZRDNYEsgUuGd3SJGQEBAQ?= X-IronPort-AV: E=Sophos;i="5.38,319,1491256800"; d="scan'208";a="223121282" Received: from mail6.webfaction.com (HELO smtp.webfaction.com) ([74.55.86.74]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 May 2017 14:43:18 +0200 Received: from [172.20.10.2] (96.235.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch [178.197.235.96]) by smtp.webfaction.com (Postfix) with ESMTP id 8B612207D1AE; Wed, 10 May 2017 12:43:14 +0000 (UTC) Date: Wed, 10 May 2017 14:43:11 +0200 From: =?utf-8?Q?Daniel_B=C3=BCnzli?= To: Ivan Gotovchits Cc: Alexey Egorov , caml-list Message-ID: In-Reply-To: References: <1494134647.612201743@f426.i.mail.ru> <645DF7BCD0884CF29575F7F16193744D@erratique.ch> <53B38F9A1D3D4732A24E8EF40B907B3F@erratique.ch> X-Mailer: sparrow 1.6.4 (build 1178) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: [Caml-list] Installing library with hidden modules On Wednesday, 10 May 2017 at 14:17, Ivan Gotovchits wrote: > So, the solution that we are using for our libraries in CMU is pretty simple, for a library/project named LIB do the following: > > 1. prefix all internal modules with the `LIB_` > 2. provide a public module `LIB.ml` that reexports some of the internals > 3. describe the public interface in `LIB.mli` > 4. do not install `cmi` and `mli` files for the internal modules. > > The public interface, of course, should not mention any internals. Yes that's exactly what I systematically do as well. Leaving aside the prefixing, the only drawback is that for large libraries this will always link in all the internal modules even if there are some your program doesn't use. Module aliases can solve this problem but I dislike the plethora of redundant names it introduces to the end-user of the API and you are still left prefixing your internal modules with `LIB_`. It's funny (or sad) to have that powerful module system with abstraction and name hiding capabilities in your hands and you end up having to do what you do in C to ensure naming isolation among libraries. I hope one day we can solve this problem without having to prefix the internal modules, without force linking all the internal modules, without multiplying the names that are exposed to the end user of the API and with generated documentation navigation that exactly matches how module items are accessed in your API. Best, Daniel