From: Andreas Rossberg <rossberg@ps.uni-sb.de>
To: "O'Caml Mailing List" <caml-list@inria.fr>
Subject: Re: [Caml-list] Renaming structures during inclusions?
Date: Wed, 11 May 2005 19:11:59 +0200 [thread overview]
Message-ID: <42823CDF.3060109@ps.uni-sb.de> (raw)
In-Reply-To: <20050511.183319.06547596.debian00@tiscali.be>
Christophe TROESTLER wrote:
>
> 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.
Note that OCaml's type system fundamentally relies on the fact that type
names cannot be shadowed in structures.
> 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
> end
> end
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.
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).
Cheers,
- Andreas
--
Andreas Rossberg, rossberg@ps.uni-sb.de
Let's get rid of those possible thingies! -- TB
next prev parent reply other threads:[~2005-05-11 17:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-11 15:44 Markus Mottl
2005-05-11 16:33 ` [Caml-list] " Christophe TROESTLER
2005-05-11 17:11 ` Andreas Rossberg [this message]
2005-05-11 18:02 ` Markus Mottl
2005-05-12 14:24 ` Andreas Rossberg
2005-05-11 18:16 ` Christophe TROESTLER
2005-05-12 1:24 ` Jacques Garrigue
[not found] ` <f8560b80505120836681ab281@mail.gmail.com>
2005-05-12 17:09 ` Markus Mottl
2005-05-12 15:26 ` Norman Ramsey
2005-05-12 20:02 ` Aleksey Nogin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42823CDF.3060109@ps.uni-sb.de \
--to=rossberg@ps.uni-sb.de \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox