From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 0FC637FB38 for ; Sun, 28 Dec 2014 18:58:19 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of lpw25@cam.ac.uk) identity=pra; client-ip=131.111.8.150; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="lpw25@cam.ac.uk"; x-sender="lpw25@cam.ac.uk"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of lpw25@cam.ac.uk) identity=mailfrom; client-ip=131.111.8.150; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="lpw25@cam.ac.uk"; x-sender="lpw25@cam.ac.uk"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@ppsw-50.csi.cam.ac.uk) identity=helo; client-ip=131.111.8.150; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="lpw25@cam.ac.uk"; x-sender="postmaster@ppsw-50.csi.cam.ac.uk"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4AABFEoFSDbwiWnGdsb2JhbABcg1hYgwWxIwaSMoV7AoELFgEBAQEBEQEBAQEBCAsJCRQuhA0BBAEjVgULCxoCBSECAg8BBEmINwgEsAiQGYREAQEIAQEBAQEdgSGEYolBMweCaIFBBZFUhTSBDTCMWoM5hBBvgkMBAQE X-IPAS-Result: Ap4AABFEoFSDbwiWnGdsb2JhbABcg1hYgwWxIwaSMoV7AoELFgEBAQEBEQEBAQEBCAsJCRQuhA0BBAEjVgULCxoCBSECAg8BBEmINwgEsAiQGYREAQEIAQEBAQEdgSGEYolBMweCaIFBBZFUhTSBDTCMWoM5hBBvgkMBAQE X-IronPort-AV: E=Sophos;i="5.07,656,1413237600"; d="scan'208";a="94851625" Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Dec 2014 18:58:18 +0100 X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from host86-182-254-133.range86-182.btcentralplus.com ([86.182.254.133]:39496 helo=study.localdomain) by ppsw-50.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (PLAIN:lpw25) (TLSv1.2:AES128-GCM-SHA256:128) id 1Y5I6b-0004Hm-s9 (Exim 4.82_3-c0e5623) (return-path ); Sun, 28 Dec 2014 17:58:17 +0000 From: Leo White To: Jordan W Cc: "caml-list\@inria.fr" References: X-Face: "XWxb[u_Z\PA_Y?9@|IA!!+jTb(/290-*ea/Un$I0B98.$n%eL.;2w*,z]WR#T:,p[ NBd++M7l]#7zj7!{~iw $W-"/=|dVjhT[D{4~gE}gK<2`.6fs!;uqqud]vs2N/3^m7{aS1V, Date: Sun, 28 Dec 2014 18:15:46 +0000 In-Reply-To: (Jordan W.'s message of "Sat, 27 Dec 2014 15:04:13 -0800") Message-ID: <87d273ljxp.fsf@study.localdomain> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Module aliases ideal name-spacing > One set of modules that form a kind of namespaced "project" MyLib. > --------- > > ~/myLib/myModule.ml > =C2=A0 open MyLib =C2=A0 =C2=A0(* This is not needed - short names are sa= me as long *) > =C2=A0 (* Sees Utils belonging to MyLib *) > > ~/myLib/utils.ml > =C2=A0 open MyLib =C2=A0 =C2=A0(* This is not needed - short names are sa= me as long *) > > ~/myLib/myLib.mli and ~/myLib/myLib.ml > =C2=A0 =C2=A0module MyModule =3D MyModule > =C2=A0 =C2=A0module Utils =3D Utils > > Another set of modules ("project") that depends on the previous project Y= ourLib > --------- > > ~/yourLib/yourModule.ml > =C2=A0 open YourLib =C2=A0 =C2=A0(* This is not needed - short names are = same as long *) > =C2=A0 (* Sees Utils belonging to YourLib *) > > ~/yourLib/utils.ml > =C2=A0 open YourLib =C2=A0 =C2=A0(* This is not needed - short names are = same as long *) > > ~/yourLib/yourLib.mli and ~/yourLib/yourLib.ml > =C2=A0 =C2=A0module YourModule =3D YourModule > =C2=A0 =C2=A0module Utils =3D Utils > > Finally, an application "project" that uses the namespaces generated by t= he previous two projects > --------- > > ~/myApp/myApp.ml > let x =3D MyLib.Utils.x + YourLib.Utils.y > You can use the `-o` and `-open` command-line options to get the behaviour you are after. If you change myLib/myLib.ml(i) to be module MyModule =3D MyLibMyModule module Utils =3D MyLibUtils and make similar changes to yourLib/yourLib.ml(i), then you can use the following commands: cd ~/myLib ocamlc -no-alias-deps myLib.mli ocamlc -no-alias-deps myLib.ml ocamlc -c -open MyLib -o myLibUtils.cmo utils.ml ocamlc -c -open MyLib -o myLibMyModule.cmo myModule.ml cd ~/yourLib ocamlc -c -no-alias-deps yourLib.mli ocamlc -c -no-alias-deps yourLib.ml ocamlc -c -open YourLib -o yourLibUtils.cmo utils.ml ocamlc -c -open YourLib -o yourLibYourModule.cmo yourModule.ml cd ~/myApp ocamlc -c -I ../myLib -I ../yourLib myApp.ml Setting up this compilation scheme in your build system might be a bit of effort, but it should work. Regards, Leo