Hi, thanks Cedric i got the point, I can separate interface from the implementation but: - if I use the module keyword I have to qualify the use of the module through the file name and the interface file should have a base name different from the implementation file - otherwise the file itself can be considered a module and I can remove module, struct and sig keywords from the code and have the same name for the interface and implementation file. Thanks a lot from the guide all these details are missing or very well hidden. Walter On Thu, 8 Sep 2011, AUGER Cedric wrote: > Le Thu, 8 Sep 2011 16:42:39 +0200 (CEST), > Walter Cazzola a écrit : > >> On Thu, 8 Sep 2011, Esther Baruk wrote: >> >>> You must also put the signature of the module type CharPQueueAbs in >>> the implementation (A.ml). >> >> this means that can't I separate signature from the implementation? >> That is do I have to keep both struct and sig in the same file? or do >> you mean something different. >> >> Thanks for the hints >> >> Walter > > You seem to have misunderstood the system of modules, I send you your > files with variants which are compilable. > Never forgot that any object declared in an interface must be > implemented (it wasn't the case in your files, since CharPQueueAbst > was declared in the mli file, but not implemented in your ml file; > note also the difference between "implemented" and "instanciated"). > ======================================================== > Implementation Interface > ======================================================== > module type X = module type X = > sig sig > type t type t > val habitant : t val habitant : t > end end > > module Habited = module Habited : X > struct > type t = bool > let habitant = true > let some_other = false > end > > module Habited2 = module Habited2 : > struct sig > type t = bool type t > let habitant = true val habitant : t > let some_other = false val some_other : t > end end > > module Habited3 = module Habited3 : > struct sig > type t = bool type t = bool > let habitant = true val habitant : bool > let some_other = false val some_other : t > end end > ======================================================== > You can generate an interface with the "-i" option. > Note that interface of 'X' is itself; > and the same module may have many possible interfaces > --