Namespace archeology
- March 19, 2015
At the very end of 2011, and then at the very beginning of 2013, I worked for some weeks on namespaces for OCaml (what they could be, why would we need them, what would be a good solution). The resulting proposal was too complex to gather steam, so I moved on – and never got around to making the documents publicly available. Here they are.
In case you are interest in archeology of design proposals (or if you want to work on namespaces for OCaml in the future), you can now access
the proposed specification (PDF) (jan 2013) for namespaces
an older design document (HTML) (jan 2012) proposing the reflection of namespaces as OCaml modules, and integration of the (underlooked) “functor-pack” idea
This work was done in collaboration with Didier Rémy, but also
Nicolas Pouillard (for the second document), and really I enjoyed
working on this and with them. The reception at the time was rather
cold, as people thought the proposal too complex with respect to the
actual needs. Alain Frisch proposed to “just extend the
module M = N
construct to do what we want”, and this was
later implemented by Jacques Garrigues as module aliases – although some
issues, such as linking against two different versions of the same
library, are still unadressed.
The proposal suggested a language to describe namespaces, and a natural tendency of programming language enthusiasts is to make their language as expressive as possible. It’s easy to make a design more frigthening than necessary by adding these couple of extra operators that make the design feel complete in this and that respect that maybe we don’t really care about.
An interesting tidbit research-wise is that I was very interested in the fact that we could reflect namespaces as OCaml modules – which I thought at the beginning to be impossible because namespaces where “open” things and modules “closed” things. In fact, we realized that modules could work for this, but that mixins would be an even better fit. A few months afterwards (and independently) Backpack ( Scott Kilpatrick, Derek Dreyer, Simon Peyton Jones and Simon Marlow) was announced as part of Scott Kilpatrick’s PhD work. It was very exciting to see related ideas masterfully developed in this different context.