From: Romain Bardou <romain@bardou.fr>
To: caml-list <caml-list@yquem.inria.fr>
Subject: Module abbreviation
Date: Tue, 15 Dec 2009 17:39:16 +0100 [thread overview]
Message-ID: <4B27BBB4.50006@bardou.fr> (raw)
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
next reply other threads:[~2009-12-15 16:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-15 16:39 Romain Bardou [this message]
2009-12-15 16:56 ` [Caml-list] " Ashish Agarwal
2009-12-15 23:28 ` 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=4B27BBB4.50006@bardou.fr \
--to=romain@bardou.fr \
--cc=caml-list@yquem.inria.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