From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 8AE3BBCAB for ; Thu, 2 Jun 2005 14:08:28 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j52C8R3b023692 for ; Thu, 2 Jun 2005 14:08:27 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA17244 for ; Thu, 2 Jun 2005 14:08:27 +0200 (MET DST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j52C8QAh032205 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 2 Jun 2005 14:08:27 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id DAC2A19E7BE; Thu, 2 Jun 2005 14:08:26 +0200 (CEST) Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 32748-05; Thu, 2 Jun 2005 14:08:26 +0200 (CEST) Received: from smtp.lri.fr (serveur3-5 [129.175.3.5]) by ext.lri.fr (Postfix) with ESMTP id C72AB19E79F; Thu, 2 Jun 2005 14:08:26 +0200 (CEST) Received: from pc8-102 (pc8-102 [129.175.8.102]) by smtp.lri.fr (Postfix) with ESMTP id BAD82CED98; Thu, 2 Jun 2005 14:08:25 +0200 (CEST) Received: from pc8-102 ([127.0.0.1] helo=localhost) by pc8-102 with esmtp (Exim 3.36 #1 (Debian)) id 1DdoUr-0002XI-00; Thu, 02 Jun 2005 14:08:25 +0200 Date: Thu, 2 Jun 2005 14:08:25 +0200 (CEST) From: Julien Signoles X-X-Sender: signoles@pc8-102 To: Keiko Nakata Cc: caml-list@inria.fr Subject: Re: [Caml-list] a module with multiple signatures In-Reply-To: <20050602.201517.68552080.keiko@kurims.kyoto-u.ac.jp> Message-ID: References: <20050602.161836.68553253.keiko@kurims.kyoto-u.ac.jp> <20050602.201517.68552080.keiko@kurims.kyoto-u.ac.jp> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Virus-Scanned: by amavisd-new at lri.fr X-Miltered: at concorde with ID 429EF6BB.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 429EF6BB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; signoles:01 signoles:01 lri:01 caml-list:01 sig:01 filliatre:01 defines:01 constructors:01 constructors:01 struct:01 sig:01 lri:01 ....:98 signatures:01 signatures:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: > This means that if I want to export T1 and T2 then I have to write as > module M1 : sig type t =3D M.t =3D T1 | T2 end =3D M > Is it correct? Yes it is. It is exactly what J.C. Filli=E2tre propose. > In my situation, M defines many types and many type constructors, > and I want to give M different signatures, each of which will export > different sets of type constructors. > Then, it seems that I have to write the same type constructor declaration= s > a number of times.... > Isn't it avoidable? You can use the "include" statement: module M =3D struct type s =3D S type t =3D T1 | T2 end module type S =3D sig type s =3D M.s =3D S end module type T =3D sig type t =3D M.t =3D T1 | T2 end module type ST =3D sig include S include T end module MS : S =3D M module MT : T =3D M module MST : ST =3D M Julien --=20 mailto:Julien.Signoles@lri.fr ; http://www.lri.fr/~signoles "In theory, practice and theory are the same, but in practice they are different" (Larry McVoy)