From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id D7763BCB6 for ; Wed, 16 Dec 2009 00:28:16 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsBAE+qJ0tRZ90vkWdsb2JhbACbRgEBAQEJCwoHEwO8DoQrBA X-IronPort-AV: E=Sophos;i="4.47,402,1257116400"; d="scan'208";a="42086143" Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]) by mail1-smtp-roc.national.inria.fr with ESMTP; 16 Dec 2009 00:28:16 +0100 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20091215232816.LCTL17029.mtaout01-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Tue, 15 Dec 2009 23:28:16 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20091215232816.OXPE22934.aamtaout04-winn.ispmail.ntl.com@romulus.metastack.com>; Tue, 15 Dec 2009 23:28:16 +0000 Received: from COUNTERTENOR (hotelastra-58.rev.fibrelac.com [83.137.80.58] (may be forged)) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id nBFNSBJ5031226 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 15 Dec 2009 23:28:13 GMT From: "David Allsopp" To: "'Ashish Agarwal'" , "'Romain Bardou'" Cc: "'caml-list'" References: <4B27BBB4.50006@bardou.fr> In-Reply-To: Subject: RE: [Caml-list] Module abbreviation Date: Wed, 16 Dec 2009 00:28:09 +0100 Message-ID: <017401ca7dde$448c7d70$cda57850$@allsopp@metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Acp9p7j7WlyIKk0pQkOeR+fDfddXLAANamTg Content-Language: en-gb Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=W3tOLUehizD4qj6VhtReFuw5MKb8d+XqjIxlDsIazEA= c=1 sm=0 a=fVm5utttEc4iLey2bvoA:9 a=EiaR7tt7LqqxeOuVVMs07dQieI8A:4 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; abbreviation:01 mli:01 sig:01 cmi:01 ocamlc:01 foo:01 mli:01 wrote:01 wrote:01 compiles:01 caml-list:01 ast:02 ast:02 toto:02 toto:02 Ashish Agarwal wrote: > If you only have a file ast.mli, you should not be able to write Ast.Sig because you do not have a module named Ast. This isn't true - the include statement works at a type system level (because you're dealing with a signature) and therefore only a .cmi file is required. It does not generate any work for the linker so a module called Ast is not actually needed when linking. > Please double check your example. It cannot be working as you describe. I'm afraid you should have checked - the example given compiles (try ocamlc -o foo ast.mli toto.ml with suitable substitutions for the "..."s) Romain Bardou wrote: > I have a file ast.mli. It has no .ml implementation as it contains only > type definitions. This is fine > I have a file toto.ml, which contains simply: > > module A = Ast But as this involves a linker instruction you need an actual module - hence the error you're seeing. I guess you could argue that the module statement could check to see if Ast only contains type definitions and relax the need for an actual module but in the general case Ast could contain values and so you need a module to link against. > I found a workaround, which is to change ast.mli to put all type > definitions in a signature, such as: This workaround works because you take the whole thing back to the type system so module implementations are not required by the linker. David