From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id A9AD0BBAF for ; Fri, 21 May 2010 15:55:16 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmMBABst9kvRVda2mGdsb2JhbACRWYxACBUBAQEBAQgJDAcRIq1OggKFLC6ITwEBAwWFDQQ X-IronPort-AV: E=Sophos;i="4.53,278,1272837600"; d="scan'208";a="59808305" Received: from mail-iw0-f182.google.com ([209.85.214.182]) by mail1-smtp-roc.national.inria.fr with ESMTP; 21 May 2010 15:55:15 +0200 Received: by iwn5 with SMTP id 5so1184346iwn.27 for ; Fri, 21 May 2010 06:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=XjN9ZEWi6+K2rwgGitHPrqkHmLTZrPteInA1RdOORZg=; b=ZJgC2kMZXFRREa0yJLbiSsacZprfz9Ar8w0mGGrRCQrOLyGTP14cRbsYLToR3IliPs 3W8Q0mk6Ave7HMjb4z2SBtUOr0cgQhi/TSwoXzVAjPJp5nX5y4i4+n/LffBpVHHSt77q bDAcH7/1CF9YVwXSNonz1aaXVE2sLUfcEkM0c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=nq9pS4cYaICVdq3WRrBDkrmuEP8mFwoOM3aDHzRCwhGweJVxur85Q5MyguBkg1++r+ ZJwR0pUFQXyl/1Pqzg6ldtVh9C+Y7Jwyitne+Y13S0OJsrxYDQF+soIzvrfUFDZYLwxK SDm76KUfuMb9F5qNszuyKCwjxCCXu3XS9zkAs= Received: by 10.231.120.69 with SMTP id c5mr1040102ibr.79.1274450114244; Fri, 21 May 2010 06:55:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.191.136 with HTTP; Fri, 21 May 2010 06:54:54 -0700 (PDT) In-Reply-To: References: From: Ashish Agarwal Date: Fri, 21 May 2010 09:54:54 -0400 Message-ID: Subject: Re: [Caml-list] Private modules in packages To: Hans Ole Rafaelsen Cc: Julien Signoles , Michael.Grunewald@laposte.net, caml-list@inria.fr Content-Type: multipart/alternative; boundary=0016e647122657faa104871b0aae X-Spam: no; 0.00; mli:01 mli:01 foo:01 rafaelsen:01 foo:01 signoles:01 signoles:01 rafaelsen:01 -pack:01 compilation:01 cmi:01 plug-ins:01 makefiles:01 compilation:01 beginner's:01 --0016e647122657faa104871b0aae Content-Type: text/plain; charset=ISO-8859-1 > 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 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 >> >> 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 > > --0016e647122657faa104871b0aae Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > write a script to generate the P.mli file

Why do yo= u 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 R= afaelsen <hraf= aelsen@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 t= he 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 proces= s.

--
Hans Ole


On Fri, May 21, 2010 at 10:53 A= M, 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 m= odules Helper, Foo and Bar. Helper provides helper functions used by Foo an= d Bar. When I'm packing them into a top mudule P, I do not want to expo= se the functions of Helper to users of P.

Is there some way to achieve this?=A0 If not, do anyone know of other w= ays for packing libraries and keeping some of the modules private to the li= brary?

Just write yourself a file p.mli with= out your private modules:
=3D=3D=3D p.mli =3D=3D=3D
module Foo : ...
module Bar : ...
=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D
Of course, you can not refer to signatures of m= odules 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 provi= ding (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.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--0016e647122657faa104871b0aae--