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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 664C4BBAF for ; Tue, 15 Dec 2009 17:57:41 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au8CAPBOJ0vRVdOsimdsb2JhbACQJYF1ghWGUT8BAQEKCQwHEQWsdYExhW6IYwECAwWEJgQ X-IronPort-AV: E=Sophos;i="4.47,400,1257116400"; d="scan'208";a="38667369" Received: from mail-yw0-f172.google.com ([209.85.211.172]) by mail2-smtp-roc.national.inria.fr with ESMTP; 15 Dec 2009 17:57:40 +0100 Received: by ywh2 with SMTP id 2so61303ywh.27 for ; Tue, 15 Dec 2009 08:57:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=cHJY9OK/5RvAqyfmJ5n32mj36Yg2iGnNmPTs41TJm0E=; b=oKS/X9V1nKc8YV/5KxwRBEYHm3x63ou2JH/nVd6BlzwIbzQFSgYKfd1I3VwVdLi/pS FBeGZu+LAtWNajkojNywgZ0Pz7BaOuPqiIoqzM5rXOx6oU92J3+Is49d/rQUHdqOD1/R qWYs8a+HuoaiWseUA7rzNf4eGWbLfyutQaV/4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=jIjkrNxw/yJGb+i/Zw33XFD31yi7e7dLPmap7uRlYzA/B1dfjSnGsnxXSp4HW0jlsY IoLzQALBi3z/WRSmlPrNPIMli7e+nOswTXzuDD0YfResDL+oaBWYrJLyX9lQnNntmz89 hNonEs/5tq5vONHrz638f3fgmhjXQ2RFPNfBQ= MIME-Version: 1.0 Received: by 10.90.43.4 with SMTP id q4mr1655658agq.31.1260896239550; Tue, 15 Dec 2009 08:57:19 -0800 (PST) In-Reply-To: <4B27BBB4.50006@bardou.fr> References: <4B27BBB4.50006@bardou.fr> From: Ashish Agarwal Date: Tue, 15 Dec 2009 11:56:55 -0500 Message-ID: Subject: Re: [Caml-list] Module abbreviation To: Romain Bardou Cc: caml-list Content-Type: multipart/alternative; boundary=00163630f795774de6047ac7481a X-Spam: no; 0.00; abbreviation:01 mli:01 sig:01 mli:01 abbreviation:01 link-time:01 cmo:01 ast':01 sig:01 beginner's:01 ocaml:01 bug:01 link-time:01 cmo:01 ast':01 --00163630f795774de6047ac7481a Content-Type: text/plain; charset=ISO-8859-1 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. Please double check your example. It cannot be working as you describe. On Tue, Dec 15, 2009 at 11:39 AM, Romain Bardou wrote: > 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 > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --00163630f795774de6047ac7481a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable If you only have a file ast.mli, you should not be able to write Ast.Sig be= cause you do not have a module named Ast. Please double check your example.= It cannot be working as you describe.

On Tue, Dec 15, 2009 at 11:39 AM, Romain Bardou <romain@bardou.fr> wrote:
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, whi= ch contains simply:

module A =3D 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 =3D
sig
=A0type t =3D ...
=A0...
end

And then, in toto.ml:

module type A =3D
sig
=A0include 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 implementatio= n) and
return its signature.

Thanks,

--
Romain Bardou

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--00163630f795774de6047ac7481a--