caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: AUGER Cedric <Cedric.Auger@lri.fr>
To: Walter Cazzola <cazzola@dico.unimi.it>
Cc: Esther Baruk <esther.baruk@gmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] separate compilation
Date: Thu, 8 Sep 2011 17:55:32 +0200	[thread overview]
Message-ID: <20110908175532.01f28fc2@lri.fr> (raw)
In-Reply-To: <alpine.LFD.2.00.1109081640590.2830@surtur.dico.unimi.it>

[-- Attachment #1: Type: text/plain, Size: 2119 bytes --]

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

[-- Attachment #2: archive.tgz --]
[-- Type: application/x-compressed-tar, Size: 1281 bytes --]

  reply	other threads:[~2011-09-08 15:56 UTC|newest]

Thread overview: 8+ 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 [this message]
2011-09-09  6:50       ` Walter Cazzola
2011-09-09  7:06         ` David Allsopp

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=20110908175532.01f28fc2@lri.fr \
    --to=cedric.auger@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=cazzola@dico.unimi.it \
    --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;
as well as URLs for NNTP newsgroup(s).