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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 006B9BBAF for ; Tue, 15 Dec 2009 17:39:36 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApkCAK9KJ0uBrw8Bh2dsb2JhbACbPwEBAQoLCAcVvH+EKwQ X-IronPort-AV: E=Sophos;i="4.47,400,1257116400"; d="scan'208";a="39928494" Received: from lri.lri.fr ([129.175.15.1]) by mail3-smtp-sop.national.inria.fr with ESMTP; 15 Dec 2009 17:39:36 +0100 Received: from localhost (localhost [127.0.0.1]) by lri.lri.fr (Postfix) with ESMTP id A35CAAD6BD for ; Tue, 15 Dec 2009 17:39:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from lri.lri.fr ([127.0.0.1]) by localhost (lri.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n+Dw2MZxuNod for ; Tue, 15 Dec 2009 17:39:36 +0100 (CET) Received: from smtp-ng.lri.fr (smtp-ng [129.175.3.73]) by lri.lri.fr (Postfix) with ESMTP id 90C25AD6A6 for ; Tue, 15 Dec 2009 17:39:36 +0100 (CET) Received: from [129.175.4.238] (lri4-238 [129.175.4.238]) by smtp-ng.lri.fr (Postfix) with ESMTP id 7E882120022 for ; Tue, 15 Dec 2009 17:39:36 +0100 (CET) Message-ID: <4B27BBB4.50006@bardou.fr> Date: Tue, 15 Dec 2009 17:39:16 +0100 From: Romain Bardou User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: caml-list Subject: Module abbreviation X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; abbreviation:01 mli:01 abbreviation:01 link-time:01 cmo:01 ast':01 mli:01 sig:01 sig:01 caml-list:01 undefined:01 ast:02 ast:02 renaming:02 toto:02 Hello, dear Caml-list, I have a file ast.mli. It has no .ml implementation as it contains only type definitions. I have a file toto.ml, which contains simply: module A = Ast So I only use it as an abbreviation, to write A.t instead of Ast.t for instance. However, at link-time, the following error occurs: File "_none_", line 1, characters 0-1: Error: Error while linking toto.cmo: Reference to undefined global `Ast' I found a workaround, which is to change ast.mli to put all type definitions in a signature, such as: module type Sig = sig type t = ... ... end And then, in toto.ml: module type A = sig include Ast.Sig end Is there any better way to write such a module abbreviation, without changing ast.mli? And, of course, without copying or renaming ast.mli into ast.ml. By the way, this is yet another evidence for the need of a construction "sig of" which would take a module (with or without implementation) and return its signature. Thanks, -- Romain Bardou