From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p896ohcN006241 for ; Fri, 9 Sep 2011 08:50:43 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjYEABK2aU6flYLKgWdsb2JhbABCqAsUAQEWJiaBRgEBBAF5BQsLGC5XBhOHdrd/hm4EkziFBYwW X-IronPort-AV: E=Sophos;i="4.68,354,1312149600"; d="scan'208";a="118927640" Received: from smtp.dico.unimi.it ([159.149.130.202]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 09 Sep 2011 08:50:41 +0200 Received: from surtur.docenti.dico.unimi.it (surtur.docenti.dico.unimi.it [159.149.152.56]) (authenticated bits=0) by smtp.dico.unimi.it (8.14.4/8.14.4) with ESMTP id p896obxT017735 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 9 Sep 2011 08:50:37 +0200 Date: Fri, 9 Sep 2011 08:50:36 +0200 (CEST) From: Walter Cazzola To: AUGER Cedric cc: Esther Baruk , OCaML Mailing List In-Reply-To: <20110908175532.01f28fc2@lri.fr> Message-ID: References: <20110908175532.01f28fc2@lri.fr> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1653113673-1315546186=:2407" Content-ID: X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (smtp.dico.unimi.it [159.149.130.202]); Fri, 09 Sep 2011 08:50:37 +0200 (CEST) X-DSI-MailScanner-Information: Please contact the staff for more information X-DSI-MailScanner-ID: p896obxT017735 X-DSI-MailScanner: Found to be clean X-DSI-MailScanner-From: cazzola@dico.unimi.it Subject: Re: [Caml-list] separate compilation This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1653113673-1315546186=:2407 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8BIT Content-ID: 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 > -- --8323328-1653113673-1315546186=:2407--