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 7EC8FBCAB for ; Wed, 11 May 2005 20:02:39 +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 j4BI2cjG014547 for ; Wed, 11 May 2005 20:02:39 +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 UAA11912 for ; Wed, 11 May 2005 20:02:38 +0200 (MET DST) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4BI2bfg014544 for ; Wed, 11 May 2005 20:02:38 +0200 Received: by wproxy.gmail.com with SMTP id 69so306777wra for ; Wed, 11 May 2005 11:02:37 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uYyT9pe8E5Ilhr0lOU1O2UQChK+5+rFC70pVcPu1B/KuMNBQRP0zkVRfED6MPzsUnICZMIhgO1UR67DrR4xr8kKzhqN7mPvHFk3ltS1xF7lmyTuzok7oHZoT+/kvP2/QkdyQ+AD/0m5mreDf56P5E7GJhBepySafUikQom3uxnk= Received: by 10.54.24.46 with SMTP id 46mr596271wrx; Wed, 11 May 2005 11:02:37 -0700 (PDT) Received: by 10.54.22.11 with HTTP; Wed, 11 May 2005 11:02:37 -0700 (PDT) Message-ID: Date: Wed, 11 May 2005 14:02:37 -0400 From: Markus Mottl Reply-To: Markus Mottl To: Andreas Rossberg Subject: Re: [Caml-list] Renaming structures during inclusions? Cc: ocaml In-Reply-To: <42823CDF.3060109@ps.uni-sb.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050511.183319.06547596.debian00@tiscali.be> <42823CDF.3060109@ps.uni-sb.de> X-Miltered: at nez-perce with ID 428248BF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 428248BD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 caml-list:01 rossberg:01 rossberg:01 ocaml's:01 compiler:01 internals:01 inference:01 compiler:01 reordering:01 higher-order:01 ocaml: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=INFO_TLD,RCVD_BY_IP autolearn=disabled version=3.0.2 X-Spam-Level: On 5/11/05, Andreas Rossberg wrote: > Note that OCaml's type system fundamentally relies on the fact that type > names cannot be shadowed in structures. Hm, I don't see why this should be so, can you elaborate? I don't know the compiler internals about type inference, this seems like a question of how types are identified internally. I make the reasonable guess that it is not by names (strings) but some kind of integer id or similar. So "type t type t" could internally still be kept apart, though producing error messages is a problem (would require printing of extra tags), and the user could not refer to the shadowed type anymore. That's why I wouldn't want the compiler to accept this code, which is the current behaviour anyway. > While your proposal probably could be made to work in this particular > case - 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, likewise > for the other elements - it is *far* from obvious if and how this can be > inferred in general, particularly when your modules go higher-order. Maybe I don't see the problem, but since I feel confident that I can always solve this problem manually in a fairly mechanized and straightforward way, I'd be surprised if this couldn't be done by the compiler. Isn't it just a normal alpha conversion problem? The only thing that needs to be guaranteed by the compiler is that there is no name capture, but that, too, isn't difficult to do. Regards, Markus --=20 Markus Mottl http://www.ocaml.info markus.mottl@gmail.com