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 968D4BCAB for ; Wed, 11 May 2005 17:44:17 +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 j4BFiHA8032709 for ; Wed, 11 May 2005 17:44:17 +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 RAA07703 for ; Wed, 11 May 2005 17:44:16 +0200 (MET DST) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4BFiGcx031335 for ; Wed, 11 May 2005 17:44:16 +0200 Received: by wproxy.gmail.com with SMTP id 69so262145wra for ; Wed, 11 May 2005 08:44:15 -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:mime-version:content-type:content-transfer-encoding:content-disposition; b=NlrSC/e9+A/ReWRsaXe+nc+LKAv3vc1AYwlsExKkms26pz/SQ39Mts7dXsEVspkKtoXsXxlFCnvA74sxaJUizrIcggcQW8x9PBqkDmi5voriaVDPEnqS+IweV6K14tm+PBagUT5+I19tuf4J6EiMdA9BiHzF02a12A0fHxlYxyY= Received: by 10.54.41.77 with SMTP id o77mr524179wro; Wed, 11 May 2005 08:44:15 -0700 (PDT) Received: by 10.54.22.11 with HTTP; Wed, 11 May 2005 08:44:15 -0700 (PDT) Message-ID: Date: Wed, 11 May 2005 11:44:15 -0400 From: Markus Mottl Reply-To: Markus Mottl To: ocaml Subject: Renaming structures during inclusions? Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Miltered: at concorde with ID 42822851.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42822850.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 struct:01 struct:01 compiler:01 bindings:01 ocaml:01 imho:01 structures:01 explicitly:01 modules:01 modules:01 renaming:02 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: Hi, I have run into a problem using the "include"-keyword for including module definitions in other modules. E.g.: ---------------------------------------------- module M1 =3D struct type t module Std =3D struct end end module M2 =3D struct type t module Std =3D struct end end module M =3D struct include M1 include M2 end ---------------------------------------------- The above is not possible, because the names for type t in M1 and M2, and the module names for module Std clash. Though it would not lead to any kind of unsoundness to allow this, it would make referring to shadowed types or modules impossible, both for the user and also for the compiler in error messages. The only solution that seems to make sense and does not impose excessive work on the user is, IMHO, to provide for a facility to rename types and modules, e.g. maybe something like: ---------------------------------------------- module M =3D struct include M1 with type t as m1_t with module Std as M1Std include M2 with type t as m2_t with module Std as M2Std module Std =3D struct include M1Std include M2Std end end ---------------------------------------------- In the above example I also added a new Std-module that includes the contents of the two old ones. The only current way to get something similar right now is to explicitly create new bindings for all entities in the modules to be included, which may be an enormous amount of work depending on their size. What do the developers think? Would it be a good idea to add a renaming facility to the language (it wouldn't even require any new keywords)? Best regards, Markus --=20 Markus Mottl http://www.ocaml.info markus.mottl@gmail.com