caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien Signoles <julien.signoles@gmail.com>
To: Goswin von Brederlow <goswin-v-b@web.de>
Cc: Ashish Agarwal <agarwal1975@gmail.com>,
	Michael.Grunewald@laposte.net, caml-list@inria.fr
Subject: Re: [Caml-list] Private modules in packages
Date: Fri, 21 May 2010 21:52:21 +0200	[thread overview]
Message-ID: <AANLkTimc9w4XqCLMaebAJRf9oNuETKk0cneNLXAvnX1X@mail.gmail.com> (raw)
In-Reply-To: <87eih5rv0x.fsf@frosties.localdomain>

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

2010/5/21 Goswin von Brederlow <goswin-v-b@web.de>

> Julien Signoles <julien.signoles@gmail.com> writes:
>
> > Hello,
> >
> > 2010/5/21 Ashish Agarwal <agarwal1975@gmail.com>
> >
> >     > write a script to generate the P.mli file
> >
> >     Why do you need Bar.mli and Foo.mli at all? Just write the P.mli
> only.
> >
> >
> > If your pack is big, you may want to mask internals of Bar and Foo to
> others
> > modules of the pack. Actually, values exported in Bar/Foo but not in P
> exactly
> > are the module counterparts of "friend methods" in OO languages.
>
> But then, if you have methods in Bar and Foo visible inside the pack but
> not from outside, you can't just cat Bar.mli and Foo.mli into
> P.mli. You need to process it to remove the 'friends' functions.
>

You can do something like that (pure ocaml without any external script):

=== file baz.mli (outside the pack P) ===
module type Foo = sig ... (* my public values here *) end

=== file p.mli ===
module Foo: Baz.Foo

=== file foo.mli ===
include Baz.Foo
... (* my friend values *)

=== file foo.ml ===
... (* all my internals: defining my public+friends+private values *)

Hope this helps,
Julien

[-- Attachment #2: Type: text/html, Size: 2133 bytes --]

      reply	other threads:[~2010-05-21 19:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-21  8:32 Hans Ole Rafaelsen
2010-05-21  8:51 ` [Caml-list] " Michaël Grünewald
2010-05-21  8:53 ` Julien Signoles
2010-05-21  9:51   ` Hans Ole Rafaelsen
2010-05-21 13:54     ` Ashish Agarwal
2010-05-21 15:42       ` Julien Signoles
2010-05-21 18:04         ` Goswin von Brederlow
2010-05-21 19:52           ` Julien Signoles [this message]

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=AANLkTimc9w4XqCLMaebAJRf9oNuETKk0cneNLXAvnX1X@mail.gmail.com \
    --to=julien.signoles@gmail.com \
    --cc=Michael.Grunewald@laposte.net \
    --cc=agarwal1975@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=goswin-v-b@web.de \
    /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).