From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p2AIaFC6010956 for ; Thu, 10 Mar 2011 19:36:15 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AowCABqpeE3RVdg2kGdsb2JhbACZHI0KCBQBAQEBCQkNBxQEIaZfijGCHoVCL4hbAQEDBYVdBIxDiGc6 X-IronPort-AV: E=Sophos;i="4.62,297,1297033200"; d="scan'208";a="77844297" Received: from mail-qw0-f54.google.com ([209.85.216.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 10 Mar 2011 19:36:09 +0100 Received: by mail-qw0-f54.google.com with SMTP id 8so2160462qwj.27 for ; Thu, 10 Mar 2011 10:36:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=6F5KqxiaSvhm4VMnAV2m2RTPZKKduvwLxEGcd+ovs8A=; b=gRdCG9UQV/xoIk7EIi2mVmkofQ6JURKI80NGV3FkXko0Q0+L8RHxijOt36rrO+vqTS bZlbGjBMJ+tHXIuzzz8LUVD6D8MpxDDQMvXALQ2WcxBTxh+NJgf3EhFrCNseds2DpQ5G q1er3GW4BHrW6nlzxyDu7LZ/47ppRpqHtU2CE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=SF3GkqiSnL6mqqh8zs1nzsEuGDs374rGif+s9ZuRDbAH5iLyVkHMARjVQ3NURDz/Tp L24j3u4etlo/GpgpfOUsypvf+XvDjp9x/4lb/Ug5WtJPw4LB3cxBtNEA6ufc9iUnVxlb THRGOpl16HXHuUHWc5wcjnUutJCU/WWoi/hBo= MIME-Version: 1.0 Received: by 10.229.130.164 with SMTP id t36mr6628397qcs.39.1299782169729; Thu, 10 Mar 2011 10:36:09 -0800 (PST) Received: by 10.229.118.75 with HTTP; Thu, 10 Mar 2011 10:36:09 -0800 (PST) Date: Thu, 10 Mar 2011 19:36:09 +0100 Message-ID: From: Hans Ole Rafaelsen To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=001517588caa831ade049e251e95 Subject: [Caml-list] Module 'annotations' with separate module files. --001517588caa831ade049e251e95 Content-Type: text/plain; charset=ISO-8859-1 Hi, is there some way to put extra module annotations on modules when each module is put in separate files. I want to have a private, friend an public interface to my modules (discussed previously in this thread: http://www.mail-archive.com/caml-list@yquem.inria.fr/msg06513.html If I put it in one file, it seems to work: module type MP = (* Signature of public module *) sig type t val make_t : int -> t val public : t -> int end module type MF = (* Signature of 'friend' module *) sig include MP val friend : t -> int end module T = (* Type of t *) struct type t = int end module MI = (* Implementation *) struct type t = T.t let make_t a = a let priv a = a + a let friend a = a + a let public a = a + a end module MP : MP = MI (* Public module *) module MF : (MF with type t = T.t) = MI (* Friend module *) module type F = (* Signatur of friend *) sig val f1 : int -> int val f2 : int -> int end module F : F = struct module M = MF let f1 a = a + (M.public (M.make_t a)) let f2 a = a + (M.friend a) end let _ = F.f1 3 let _ = F.f2 3 let _ = MP.public (MP.make_t 10) But I can not figure out how to put the signatures on MP and MF modules when I put them in mP.ml and mF.ml. Do I need to put them inside nested structs inside the files? Thanks, Hans --001517588caa831ade049e251e95 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

is there some way to put extra module annotations on modules whe= n each module is put in separate files. I want to have a private, friend an= public interface to my modules (discussed previously in this thread:
http://www.mail-archive.com/caml-list@yquem.inria.fr/msg06513.html<= br>
If I put it in one file, it seems to work:
module type MP =3D (* = Signature of public module *)
sig
=A0 type t
=A0 val make_t : int -> t
=A0 val public : t -&g= t; int
end
=A0
module type MF =3D (* Signature of 'friend'= ; module *)
sig
=A0 include MP
=A0 val friend : t -> int
end=

module T =3D (* Type of t *)
struct
=A0 type t =3D int
end

module MI =3D (* Implementation = *)
struct
=A0 type t =3D T.t
=A0 let make_t a =3D a
=A0 let pri= v a =3D a + a
=A0 let friend a =3D a + a
=A0 let public a =3D a + aend


module MP : MP =3D MI (* Public module *)
module MF : (MF with type t =3D T.t) =3D MI (* Friend module *)


= module type F =3D (* Signatur of friend *)
sig
=A0 val f1 : int ->= int
=A0 val f2 : int -> int
end


module F : F =3D
st= ruct
=A0 module M =3D MF
=A0 let f1 a =3D a + (M.public (M.make_t a))
=A0 = let f2 a =3D a + (M.friend a)
end



let _ =3D F.f1 3
let= _ =3D F.f2 3
let _ =3D MP.public (MP.make_t 10)

But I can not fi= gure out how to put the signatures on MP and MF modules when I put them in = mP.ml and mF.ml. Do I need to put them inside nested structs inside the fil= es?

Thanks,

Hans

--001517588caa831ade049e251e95--