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

> Julien Signoles <julien.signo...@gmail.com> writes:
>
> > Hello,
> >
> > 2010/5/21 Ashish Agarwal <agarwal1...@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
_______________________________________________
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

Reply via email to