From: Ashish Agarwal <agarwal1975@gmail.com>
To: Hans Ole Rafaelsen <hrafaelsen@gmail.com>
Cc: Julien Signoles <julien.signoles@gmail.com>,
Michael.Grunewald@laposte.net, caml-list@inria.fr
Subject: Re: [Caml-list] Private modules in packages
Date: Fri, 21 May 2010 09:54:54 -0400 [thread overview]
Message-ID: <AANLkTilwL0e77aXR7xYL6rYZNp01IOlt9EzbtIA_3bbK@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimFewf3sgsCZDJtXI-AzwR3Qh0feeVvugM3lrle@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2338 bytes --]
> 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.
On Fri, May 21, 2010 at 5:51 AM, Hans Ole Rafaelsen <hrafaelsen@gmail.com>wrote:
> Thanks Michael and Julien,
>
> That did the trick. I manually inserted the content of the Bar.mli and
> Foo.mli into the P.mli file. Guess unless it is some way to include this
> automatically the best will be to write a script to generate the P.mli file
> automatically based on current version of Bar.mli and Foo.mli as part of the
> build process.
>
> --
> Hans Ole
>
>
> On Fri, May 21, 2010 at 10:53 AM, Julien Signoles <
> julien.signoles@gmail.com> wrote:
>
>> Hello,
>>
>> 2010/5/21 Hans Ole Rafaelsen <hrafaelsen@gmail.com>
>>
>> When packing a set of modules into a top module using -pack, is there a
>>> way to have some of the modules private to the package?
>>>
>>> If I have the modules Helper, Foo and Bar. Helper provides helper
>>> functions used by Foo and Bar. When I'm packing them into a top mudule P, I
>>> do not want to expose the functions of Helper to users of P.
>>>
>>> Is there some way to achieve this? If not, do anyone know of other ways
>>> for packing libraries and keeping some of the modules private to the
>>> library?
>>>
>>
>> Just write yourself a file p.mli without your private modules:
>> === p.mli ===
>> module Foo : ...
>> module Bar : ...
>> ==========
>> Of course, you can not refer to signatures of modules Foo and Bar in
>> p.mli. Thus you have to duplicate them or, better, to write them somewhere
>> outside the package.
>>
>> From a compilation point of view, be sure to generate p.cmi by using p.mli
>> before generating the pack files p.cm[ox].
>>
>> We use such a trick in the Frama-C tool (http://frama-c.com) for
>> providing (usually empty) interfaces of its plug-ins. But I do not recommend
>> you to read the Frama-C Makefiles for looking at the corresponding
>> compilation lines (except if you are **very** motivated).
>>
>> Hope this helps,
>> Julien
>>
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
[-- Attachment #2: Type: text/html, Size: 3630 bytes --]
next prev parent reply other threads:[~2010-05-21 13:55 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 [this message]
2010-05-21 15:42 ` Julien Signoles
2010-05-21 18:04 ` Goswin von Brederlow
2010-05-21 19:52 ` Julien Signoles
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=AANLkTilwL0e77aXR7xYL6rYZNp01IOlt9EzbtIA_3bbK@mail.gmail.com \
--to=agarwal1975@gmail.com \
--cc=Michael.Grunewald@laposte.net \
--cc=caml-list@inria.fr \
--cc=hrafaelsen@gmail.com \
--cc=julien.signoles@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