From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8976mrU007247 for ; Fri, 9 Sep 2011 09:06:48 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlMBAPy5aU5RZ90wkWdsb2JhbABCqAsUAQEBAQkLCwcUAyOBRgEBAQECATpECwIBCBgKFBAyJQIEG4duAgK3bYYOYASTOJEZ X-IronPort-AV: E=Sophos;i="4.68,354,1312149600"; d="scan'208";a="108228021" Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]) by mail4-smtp-sop.national.inria.fr with ESMTP; 09 Sep 2011 09:06:43 +0200 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20110909070642.WROE17426.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Fri, 9 Sep 2011 08:06:42 +0100 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20110909070642.JJSK5924.aamtaout02-winn.ispmail.ntl.com@romulus.metastack.com> for ; Fri, 9 Sep 2011 08:06:42 +0100 Received: from remus.metastack.local ([172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id p8976dAg008848 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Fri, 9 Sep 2011 08:06:39 +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.01.0289.001; Fri, 9 Sep 2011 08:06:38 +0100 From: David Allsopp To: OCaML Mailing List Thread-Topic: [Caml-list] separate compilation Thread-Index: AQHMbjNi63if1zm1FU66BjPSOUw6XpVDe04AgAACpICAABRdAIAA+hQAgAATiPA= Date: Fri, 9 Sep 2011 07:06:36 +0000 Message-ID: References: <20110908175532.01f28fc2@lri.fr> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [217.153.72.122] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=c9hE-h4VYVIA:10 a=MtGdcxtscqIA:10 a=cTs9vV391PwA:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=ZOzjf2MOAAAA:8 a=7xJHqFAY26qZa-7YcbsA:9 a=Sw2xvLSWrq5jcYE8EyoA:7 a=CjuIK1q_8ugA:10 a=3-88ac0g29QA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p8976mrU007247 Subject: RE: [Caml-list] separate compilation Walter Cazzola wrote: > Hi, > thanks Cedric i got the point, I can separate interface from the > implementation but: The main point of interfaces is to constrain the inferred interface of a module (e.g. hide functions or types which shouldn't be exposed to another module or constraint polymorphic variables to a specific type). It's not like C - you're not declaring a header file which you then usually include in the implementation itself (and, yes, it does unfortunately result in some code duplication - at least in terms of type definitions) > - if I use the module keyword I have to qualify the use of the module > through the file name and the interface file should have a base name > different from the implementation file Yes, because the module is a sub-module of the module defined by the file. > - otherwise the file itself can be considered a module and I can remove > module, struct and sig keywords from the code and have the same name > for the interface and implementation file. It's not that the file "can be considered a module" - it entirely is a module with the case sensitive (except for the first character) filename being the module name (so module Foo should be kept in foo.ml or Foo.ml) > Thanks a lot from the guide all these details are missing or very well > hidden. Chapter 2 of the manual "The module system", section 5 "Modules and separate compilation" - http://caml.inria.fr/pub/docs/manual-ocaml/manual004.html#toc17 David