caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ashish Agarwal <agarwal1975@gmail.com>
To: Romain Bardou <romain@bardou.fr>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Module abbreviation
Date: Tue, 15 Dec 2009 11:56:55 -0500	[thread overview]
Message-ID: <d8be5ae20912150856l59d0fbeeyfda2628cfbfe5b96@mail.gmail.com> (raw)
In-Reply-To: <4B27BBB4.50006@bardou.fr>

[-- Attachment #1: Type: text/plain, Size: 1640 bytes --]

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 <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, 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
>

[-- Attachment #2: Type: text/html, Size: 2499 bytes --]

  reply	other threads:[~2009-12-15 16:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-15 16:39 Romain Bardou
2009-12-15 16:56 ` Ashish Agarwal [this message]
2009-12-15 23:28   ` [Caml-list] " David Allsopp
     [not found]   ` <-5655904566200171061@unknownmsgid>
2009-12-16  3:17     ` Ashish Agarwal
2009-12-15 17:01 ` Basile STARYNKEVITCH
2009-12-17 11:35   ` Romain Bardou
2009-12-18  6:55     ` Basile STARYNKEVITCH
2009-12-18 12:06       ` Romain Bardou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8be5ae20912150856l59d0fbeeyfda2628cfbfe5b96@mail.gmail.com \
    --to=agarwal1975@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=romain@bardou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).