From: Walter Cazzola <cazzola@dico.unimi.it>
To: AUGER Cedric <Cedric.Auger@lri.fr>
Cc: Esther Baruk <esther.baruk@gmail.com>,
OCaML Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] separate compilation
Date: Fri, 9 Sep 2011 08:50:36 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.1109090725180.2407@surtur.dico.unimi.it> (raw)
In-Reply-To: <20110908175532.01f28fc2@lri.fr>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2738 bytes --]
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 <cazzola@dico.unimi.it> 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
>
--
next prev parent reply other threads:[~2011-09-09 6:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-08 14:26 Walter Cazzola
2011-09-08 14:33 ` Philippe Wang
2011-09-08 14:40 ` Walter Cazzola
2011-09-08 14:33 ` Esther Baruk
2011-09-08 14:42 ` Walter Cazzola
2011-09-08 15:55 ` AUGER Cedric
2011-09-09 6:50 ` Walter Cazzola [this message]
2011-09-09 7:06 ` David Allsopp
2025-04-05 4:26 [Caml-list] Separate compilation Oleg
2025-04-07 21:55 ` Edwin Török
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=alpine.LFD.2.00.1109090725180.2407@surtur.dico.unimi.it \
--to=cazzola@dico.unimi.it \
--cc=Cedric.Auger@lri.fr \
--cc=caml-list@inria.fr \
--cc=esther.baruk@gmail.com \
/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