From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.5 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 3F03BBB84 for ; Tue, 10 Feb 2009 19:15:24 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AugBAIhSkUlIDtyckGdsb2JhbACUCj8BAQEBCQkMBxEDr1ePUgEDAQOEFwaCNoFu X-IronPort-AV: E=Sophos;i="4.38,187,1233529200"; d="scan'208";a="20913922" Received: from fg-out-1718.google.com ([72.14.220.156]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Feb 2009 19:15:23 +0100 Received: by fg-out-1718.google.com with SMTP id 16so11136fgg.25 for ; Tue, 10 Feb 2009 10:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=9cxGe9iAs79nhb0j78E2mzBTw8aIV3mPDd8FXjR1DwA=; b=q1BYgYSKTEBU9RpeP96P7U1dJyK48lWVu7aKsxPjucDfqC8Z2KHaz7iUsFpR6KtjLO SVBAoD2Ey8J1pK/tRU2TUJ4JdyddwFWx+L4RLU8htH19L1fjspsxm1LPwc/4pcErnT+F RMiIlZCZ/+PKthM2H81J1gk01BS+ja2V3i8aY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=UPV5e6rYcJTKxXduYElCnptubSIlamxUkTnwjh6f4/aEJpKrwUPzuiqFGQhuCD4brJ Nja2ucdhWXt3M6dYOHTzrqD/m8WRasCNj9fh09W9uaZlgtMU2g9lJemCyr4oUp6T3HTY 6uojNrE+cgG63PKz3xfxjSVNUUW1oTCW1vOgo= Received: by 10.86.29.8 with SMTP id c8mr20763fgc.19.1234289723511; Tue, 10 Feb 2009 10:15:23 -0800 (PST) Received: from ?192.168.1.34? (174-102.76-83.cust.bluewin.ch [83.76.102.174]) by mx.google.com with ESMTPS id e20sm2064650fga.56.2009.02.10.10.15.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 10 Feb 2009 10:15:23 -0800 (PST) Sender: =?UTF-8?Q?Daniel_B=C3=BCnzli?= Cc: OCaml Message-Id: From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= To: David Rajchenbach-Teller In-Reply-To: <1234286066.6457.35.camel@Blefuscu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: [Caml-list] Hiding private types Date: Tue, 10 Feb 2009 19:14:42 +0100 References: <1234286066.6457.35.camel@Blefuscu> X-Mailer: Apple Mail (2.930.3) X-Spam: no; 0.00; bunzli:01 buenzli:01 submodule:01 submodules:01 functors:01 toplevel:01 mli:01 struct:01 sig:01 val:01 sig:01 val:01 toplevel:01 functors:01 caml-list:01 Le 10 f=E9vr. 09 =E0 18:14, David Rajchenbach-Teller a =E9crit : > Does anyone have an idea of how we could/should do this? I already encoutered these kind of visilibility problems, I'm not sure =20= the following applies to your case but it's a case I managed to solve =20= (e.g. in react [1]). Suppose you have two types Pack.a and Pack.b, and two submodule Pack.A =20= and Pack.B that define functions on the respective types. In these two =20= modules you also want to have Pack.A.t =3D Pack.a and Pack.B.t =3D Pack.b so that the submodules =20= can be given to the usual functors. The problem is then that when you use functions from Pack.A in the =20 toplevel you get values of type A.Pack.t =3D Pack.a but you would like =20= Pack.a to be printed. The solution is simple : in the mli of A and B =20 the signature of functions should use Pack.a and Pack.b, in other =20 words your signature should look like this : module Pack =3D struct type a type b module A : sig type t =3D a val create : unit -> a (* instead of unit -> t *) end module B : sig type t =3D b val create : unit -> b (* instead of unit -> t *) end end This way you never get Pack.A.t and Pack.B.t in errors and in the =20 toplevel unless you request it by a type annotation (or use functors). But I don't know if you can reorder your definitions to match this =20 pattern. Best, Daniel [1] http://erratique.ch/software/react