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
About namespaces
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-11-20 (21:29)
From: David Rajchenbach-Teller <David.Teller@e...>
Subject: About namespaces
At the moment, there is no difference between modules and namespaces.
Among other things, this means that if I write an extension MyList to
List and someone else writes and extension HisList to List, there is no
automated way to merge these, I need to write yet another module
LatestList to be able to use both extensions at the same time. While
this is certainly possible, it's also quite clumsy and prevents drop-in
additions to existing modules (or hierarchies, yes) by third-party
libraries, something which, as Richard Jones points out, may be

All of this is due to the fact that modules are closed: once a module
has been written, there is no way to add something to that module
without altering the source code or writing a new module.

Now, David Allsopp suggested (off-list) that we could perhaps implement
namespaces as a Camlp4 extension, with the use of external configuration
files (something which can already be managed with findlib). I'm
shamelessly forwarding his idea and asking for feedback.

Where we have [open List] to open one specific module called [List], we
could introduce
* [use List] to open all the modules registered as providing namespace
* [import List] to locally rebind [List] to a module obtained by
including all the modules registered as providing namespace [List]

In each case, finding out which modules are registered as providing
namespace [List] is performed statically, by Camlp4 reading a set of
external configuration files.

What do you think?

David Teller-Rajchenbach
 Security of Distributed Systems
 Angry researcher: French Universities need reforms, but the LRU act brings liquidations.