From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 9B118BCAB for ; Wed, 11 May 2005 20:16:32 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4BIGWdR015775 for ; Wed, 11 May 2005 20:16:32 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA12220 for ; Wed, 11 May 2005 20:16:31 +0200 (MET DST) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4BIGTKl020625 for ; Wed, 11 May 2005 20:16:31 +0200 Received: from poincare (Debian-exim@poincare.swapping.umh.ac.be [10.102.100.67]) by hedwig1.umh.ac.be (8.13.1/8.13.1) with ESMTP id j4BIH4Xs2253016; Wed, 11 May 2005 20:17:06 +0200 Received: from localhost ([127.0.0.1] ident=trch) by poincare with esmtp (Exim 4.50) id 1DVvkt-0005R8-Vu; Wed, 11 May 2005 20:16:25 +0200 Date: Wed, 11 May 2005 20:16:23 +0200 (CEST) Message-Id: <20050511.201623.123148110.debian00@tiscali.be> To: "O'Caml Mailing List" Subject: Re: [Caml-list] Renaming structures during inclusions? From: Christophe TROESTLER In-Reply-To: <42823CDF.3060109@ps.uni-sb.de> References: <20050511.183319.06547596.debian00@tiscali.be> <42823CDF.3060109@ps.uni-sb.de> Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: hackers cybercash CID bank NORAD North Korea Armani military eternity server Bosnia X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: GNU/Linux (http://www.linux.org/) X-Mailer-URL: http://www.mew.org/ X-Mailer: Mew version 4.2 on Emacs 21.4 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at nez-perce with ID 42824C00.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42824BFD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 christophe:01 troestler:01 rossberg:01 rossberg:01 ocaml's:01 sig:01 compiler:01 reordering:01 higher-order:01 higher-order:01 sigs:01 sig:01 explicitely:01 markus:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.5 required=5.0 tests=FROM_ENDS_IN_NUMS autolearn=disabled version=3.0.2 X-Spam-Level: On Wed, 11 May 2005, Andreas Rossberg wrote: > > Note that OCaml's type system fundamentally relies on the fact that > type names cannot be shadowed in structures. Yes, you are correct -- I was thinking of checking the sig against a given one, not to generate it. > the compiler had to figure out that it can break the dependency on > the first t by reordering m1_t relative to the fields from M1 in the > derived signature and substituting m1_t for t in these fields, [...] > it is *far* from obvious if and how this can be inferred in general, > particularly when your modules go higher-order. > > I believe it would require something akin to join and meet operations on > signatures, but it is known that these don't exist for some very similar > systems (signatures for higher-order modules don't form a lattice). The substitution in itself is nothing difficult, isn't it. Or is it because you need to "backtrack" to change the inferred sigs? Is the problem when to do it? Do you have examples? I do not immediately see why a rule like "duplicate types/modules are forbidden in a sig unless one of them is explicitely renamed" would be difficult to check[1]. On the other hand, one may also argue that Markus proposal is cleaner. Regards, ChriS [1] E.g. -- the simpler -- when the shadowing occurs (this is already detected), an alternative name for the type must be available.