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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 98C667FF50 for ; Tue, 9 Aug 2016 00:54:50 +0200 (CEST) IronPort-PHdr: 9a23:kn0SyxUiHyqmvUf678ixUVzqlBjV8LGtZVwlr6E/grcLSJyIuqrYZhOAt8tkgFKBZ4jH8fUM07OQ6PG4Hz1Zqs7b+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLshrj0qsSYO18ArQH+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t4XXskyJSAyI/XwAWU0ZlxNJB07O6xSwFsP0tSzhsfZ28CafNMzyC7szXGLxwb1sTUrEgTkGO3YQ9GXMjdRoxPZXuhvkoRFg2KbRbZ2cL+Z3daCbdtQfEzkSFv1NXjBMV9vvJ7AECPAMaKMB99Hw Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=dra-news@metastack.com; spf=Pass smtp.mailfrom=dra-news@metastack.com; spf=None smtp.helo=postmaster@outmail148113.authsmtp.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.148.113; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of dra-news@metastack.com designates 62.13.148.113 as permitted sender) identity=mailfrom; client-ip=62.13.148.113; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@outmail148113.authsmtp.com) identity=helo; client-ip=62.13.148.113; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail148113.authsmtp.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AGAACyDKlXl3GUDT5dgxiBA3wHpA4GiFiOJRyGAQKBQzwQAQEBAQEBAQERAQEBAQEIFgc9C4IyBAETAYITAQEFOjoFEAIBCBgeECERJQIEDgUIEod9AxgDAb5UDYQuAQEIAQEBAQEBASCFYoUVgkOBf4Mqgi8FmQU0jE+COwqPOYgtIYdeNYJCgVduhXd/AQEB X-IPAS-Result: A0AGAACyDKlXl3GUDT5dgxiBA3wHpA4GiFiOJRyGAQKBQzwQAQEBAQEBAQERAQEBAQEIFgc9C4IyBAETAYITAQEFOjoFEAIBCBgeECERJQIEDgUIEod9AxgDAb5UDYQuAQEIAQEBAQEBASCFYoUVgkOBf4Mqgi8FmQU0jE+COwqPOYgtIYdeNYJCgVduhXd/AQEB X-IronPort-AV: E=Sophos;i="5.28,492,1464645600"; d="scan'208";a="229374940" Received: from outmail148113.authsmtp.com ([62.13.148.113]) by mail2-smtp-roc.national.inria.fr with ESMTP; 09 Aug 2016 00:54:49 +0200 Received: from mail-c232.authsmtp.com (mail-c232.authsmtp.com [62.13.128.232]) by punt21.authsmtp.com (8.14.2/8.14.2/) with ESMTP id u78MsmmD047943; Mon, 8 Aug 2016 23:54:48 +0100 (BST) Received: from romulus.metastack.com (114.212-105-213.static.virginmediabusiness.co.uk [213.105.212.114]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id u78Msl6Z023091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Aug 2016 23:54:48 +0100 (BST) Received: from remus.metastack.local (remus.metastack.com [172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id u78Mskuf020180; Mon, 8 Aug 2016 23:54:46 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%10]) with mapi id 14.03.0301.000; Mon, 8 Aug 2016 23:54:46 +0100 From: David Allsopp To: "moosotc@gmail.com" CC: Gabriel Scherer , caml users Thread-Topic: [Caml-list] Interface(.mli) location Thread-Index: AQHR8a9sWCvy6CNG7kmmtpBMUxmENKA/q6cg Date: Mon, 8 Aug 2016 22:54:45 +0000 Message-ID: References: <8737mfp7j3.fsf@gmail.com> <87y447npv3.fsf@gmail.com> <87r39znl6m.fsf@gmail.com> <87mvknnia0.fsf@gmail.com> In-Reply-To: <87mvknnia0.fsf@gmail.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.0.29] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Server-Quench: 1b91e776-5dbb-11e6-829e-00151795d556 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNl8UURhQ KkJXbgESJgVMAnhE VHkJW1VSQF9yU2Zx YQ5ZIwdcYVRPXwB0 UklLXFNTEBpqBAMA SFsZWmQxKwMseHxz ZU9jEHFZWERyO0cv S08BEmoAeGI0OjIC UUENcR5ccgofYx9F a1V+U3oINWACYDQC Ml17DBs4ODEaLCVO XjRFDFQOTFwFFzUx B1YHGTRuVUkCTCwv LhsgQl4B X-Authentic-SMTP: 61633634383431.1037:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 213.105.212.114/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: RE: [Caml-list] Interface(.mli) location moosotc@gmail.com wrote: > David Allsopp writes: > > moosotc@gmail.com wrote: > >> David Allsopp writes: > >> > moosotc@gmail.com wrote: > >> >> Gabriel Scherer writes: > >> >> > >> >> > It is correct that ocamldep assumes that the .ml and .mli of a > >> >> > given module are at the same place, but this is not the case for > >> >> > the rest of the compilation chain, which is either concerned > >> >> > with single source files (a .ml file or a .mli file) or with > >> >> > "compilation units" (a .cmo and .cmi files passed together, > >> >> > independently of where their source files were). In particular, > >> >> > all type-checking tools do look in -I directories to find .cmi > >> >> > files for the dependencies of the module being compiled (and at > >> >> > this stage > >> they do not care for .mli files). > >> >> > >> >> But the script seems to (somewhat) contradict this, i.e. after > >> >> `ocamlc -I d -c a.ml' ocamlc ignores the presence of .mli inside > >> >> subdirectory d/, producing both .cmi/.cmo when when compiling a.ml. > >> > > >> > The -I option specifies extra directories for compiled files only, > >> > so it's correct that the compiler ignores d/a.mli. > >> > >> After sending the first post I've realized that: ocamlc -c d/a.mli > >> was forgotten, but even after adding that to the script things do not > >> change, i.e. following compilation of a.ml with -I d where d contains > >> a.cmi still produces both a.cmo and a.cmi in the top-level directory. > > > > Indeed - but that's the correct documented behaviour, even if not > > necessarily the ideal. There are various things you can do: > > > > a) Delete ./a.cmi as part of your build procedure. This isn't ideal, > > though, because you lose the type-checking against d/a.cmi > > b) Have an empty ./a.mli but never compile it - the compiler will then > > unify ./a.cmo against d/a.cmi. This isn't ideal because having a > > source file which you don't expect to compile will confuse dependency > > generators and automatic build rules. > > c) Implement a new option in the compiler driver which suppresses the > > automatic generation of .cmi files (e.g. ocamlc -c -I d -no-cmi a.ml) >=20 > d) Make the compiler skip generation of .cmi if it sees one in the -I > directories? No - I think the use-case is too niche to justify breaking backwards compat= ibility. That's potentially a very subtle way to break someone else's exist= ing build system. The existing behaviour is precisely documented in the man= ual (even if it's not necessarily the best approach). David