caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Module abbreviation
@ 2009-12-15 16:39 Romain Bardou
  2009-12-15 16:56 ` [Caml-list] " Ashish Agarwal
  2009-12-15 17:01 ` Basile STARYNKEVITCH
  0 siblings, 2 replies; 8+ messages in thread
From: Romain Bardou @ 2009-12-15 16:39 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-12-18 12:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-15 16:39 Module abbreviation Romain Bardou
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

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).