English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Renaming structures during inclusions?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-05-11 (16:33)
From: Christophe TROESTLER <debian00@t...>
Subject: Re: [Caml-list] Renaming structures during inclusions?
On Wed, 11 May 2005, Markus Mottl <markus.mottl@gmail.com> wrote:
> The above is not possible, because the names for type t in M1 and M2,
> and the module names for module Std clash.

Wouldn't it be better to have a compiler switch (say "-w T/t", off by
default) to overide that behavior (new definitions override old ones
as with [open])?  Of course that makes it impossible to write M1
signature without aliasing [t] and [Std] but IMHO that's fine.  This
way, no new syntax needs to be introduced (and one is not forced to
alias modules one does not care about -- e.g. utilities).

module M = struct
  include M1
  type m1_t = M1.t
  module M1Std = M1.Std

  include M2
  type m2_t = M2.t
  module M2Std = M2.Std

  module Std = struct
    include M1.Std
    include M2.Std

My 2¢,