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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id ACADBBC6B; Sat, 17 Mar 2007 14:52:37 +0100 (CET) Received: from ipmail03.adl2.internode.on.net (ipmail03.adl2.internode.on.net [203.16.214.135]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2HDqY9n029149; Sat, 17 Mar 2007 14:52:36 +0100 Received: from ppp41-108.lns2.syd6.internode.on.net (HELO [192.168.1.201]) ([59.167.41.108]) by ipmail03.adl2.internode.on.net with ESMTP; 18 Mar 2007 00:22:31 +1030 X-IronPort-AV: i="4.14,295,1170595800"; d="scan'208"; a="63843151:sNHT24222737" Subject: Modules for Dummies From: skaller To: Alain Frisch Cc: Caml List In-Reply-To: <45FBA365.5060700@inria.fr> References: <80E2E3A7-2603-4706-8186-566C6DA14452@gmail.com> <729DDA34-5FBE-4570-B10F-B2443B58A2F1@gmail.com> <8FC891E5-C8B6-410F-B2EB-5E06594A0165@gmail.com> <20070316142205.GB28353@yquem.inria.fr> <1174090706.10421.29.camel@rosella.wigram> <45FBA365.5060700@inria.fr> Content-Type: text/plain Date: Sun, 18 Mar 2007 00:52:26 +1100 Message-Id: <1174139546.21671.35.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 45FBF2A2.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0100,:01 frisch:01 foo:01 foo:01 functor:01 struct:01 struct:01 val:01 val:01 sourceforge:01 wrote:01 wrote:01 abstract:01 abstract:01 constraint:01 On Sat, 2007-03-17 at 09:14 +0100, Alain Frisch wrote: [changed the title to something more appropriate] > skaller wrote: > > So actually, this F is distinct from Foo, even though all the > > members are the same. In particular, if Foo has an abstract type t, > > is F.t the same type as Foo.t? > > Yes, because the signature inferred for F keeps a sharing constraint > t = Foo.t. But if G is some functor with an abstract type s in the > result, then G(F).s and G(Foo).s are not equal (because there is no > sharing constraint between modules, such as F = Foo). Hmm .. this is quite hard to understand. So let's consider: module F = Foo module G = Foo then F.t and G.t are also the same type because they both have an inferred sharing constraint t = Foo.t, but F, G, and Foo are distinct modules. Perhaps I could also write: module Foo = struct type t = int end module F = struct type t constraint t = Foo.t val x = 1 end module G = struct type t constraint t = Foo.t val y = 2 end to get the same sharing? but clearly Foo, F, G are distinct. -- John Skaller Felix, successor to C++: http://felix.sf.net