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=1.5 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 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 E9420BC37 for ; Thu, 14 May 2009 09:58:10 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah8CAOhrC0rVhjEYkGdsb2JhbACXGwEBAQEJCQwHEQO2Z4QCBQ X-IronPort-AV: E=Sophos;i="4.38,431,1233529200"; d="scan'208";a="29282836" Received: from ihsmtp02voda.lis.interhost.com (HELO ihsmtp02cons.lis.interhost.com) ([213.134.49.24]) by mail1-smtp-roc.national.inria.fr with ESMTP; 14 May 2009 09:58:10 +0200 Received: from [192.168.1.64] ([77.54.249.136]) by ihsmtp02cons.lis.interhost.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 14 May 2009 08:55:06 +0100 Message-ID: <4A0BCF0D.6060207@inescporto.pt> Date: Thu, 14 May 2009 08:58:05 +0100 From: Hugo Ferreira User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: Jacques Carette Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Shared types: dependency in modules with polymorphic type References: <4A0B1B81.8090700@inescporto.pt> <4A0B2218.2050305@mcmaster.ca> In-Reply-To: <4A0B2218.2050305@mcmaster.ca> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 May 2009 07:55:06.0933 (UTC) FILETIME=[4C0CC650:01C9D469] X-Spam: no; 0.00; struct:01 unification:01 annotations:01 polymorphic:01 wrote:01 wrote:01 abstract:01 caml-list:01 dependency:01 constraint:01 modules:02 modules:02 declaration:02 checking:02 constraints:03 Hi Jacques, Jacques Carette wrote: > One modification which will get you a long way towards your goal is to > remove the : VB from > > Hugo Ferreira wrote: >> module VB1 : VB >> = struct ... > While this may look like it is just "type checking", it in fact does > more and makes sure that VB1.t, to the outside world, is abstract. This > stops any possibility of unification with 'like' types. Same with Make_U. > > Note that VB1 will still be of type VB, and you can be sure of that > because the constraint in Make_U's signature will enforce it -- only a > bit later than at declaration time, at use-time. > Understood. I was only thinking of the interface. >> My question is: is their any way I may organize the modules or >> indicate shared types in order to use a (very extensive) VB >> interface (Or VB1 module)? Specifically how do I enforce the >> shared type: >> >> U1.instance VB1.t = U1.t = Make_U(VB1).t > First, try the above. It may help. If it does not, then you will need > to add explicit sharing constraints. But which sharing constraints are > *really* needed will be the ones revealed by first removing the type > annotations you currently have. > Worked correctly. However I need only remove the U in Make_U : U and change it to a simple Make_U. "U1.t" now becomes visible and binds correctly. > Note that you should not have to re-organize your modules at all to > achieve this [at least, not in this example]. > Worked like a charm. No additional changes. Thank you, Hugo F. > Jacques >