English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] type issues with modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-11 (17:24)
From: Damien <Damien.Pous@e...>
Subject: Re: [Caml-list] type issues with modules
On Tue, 11 Nov 2003 17:21:47 +0900 Jacques Garrigue wrote:
> As specified in the reference manual, the combination of .ml and .mli
> is expected to mean:
>   module type Sig_mod1 = sig <mod1.mli> end
>   module Struct_mod1 = struct <mod1.ml> end
>   module Mod1 : Sig_mod1 = Struct_mod1

Let's be a bit fussy...
The manual says :
	module Mod1: sig <mod1.mli> end = struct <mod1.ml> end

Hopefully, because the first translation would export hidden parts of
Mod1 via Struct_mod1.

But I think that giving a name to the signature of Mod1 (Sig_mod1) could
be useful :

	module type MOD1 : sig <mod1.mli> end
	module Mod1 : MOD1 = struct <mod1.ml> end

Especially when hand-packing some modules : 
"ocamlc -pack" checks the packed cmo against an optional interface file,
but the latter is rather boring to write, since one has to copy&paste
the content of each packed interface.

If the module types were given a name, one could just write 
	module Mod1: MOD1


PS: I tried "module Mod1: Sig_mod1", of course it doesn't work :-(

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners