Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Christophe TROESTLER <debian00@t...>
Subject: Re: [Caml-list] Renaming structures during inclusions?
On Wed, 11 May 2005, Andreas Rossberg <rossberg@ps.uni-sb.de> 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.