[ocaml-platform] on the need and design of OCaml namespaces

Daniel Bünzli daniel.buenzli at erratique.ch
Fri Feb 22 12:42:21 GMT 2013


Le vendredi, 22 février 2013 à 12:38, Wojciech Meyer a écrit :
> The reason why I think we should use hierarchy is:
> - ability to structure several libraries into same "shelves" - looking
> what Haskell does [1]: Control.Arrow or Data.Array. It will help to
> provide one and consistent library for the platform. It does not
> necessarily require (but enables) to use "provenance" style of naming
> (e.g. Java convention)

Actually I find this way of structuring things not pertinent *at all*. It brings absolutely nothing.

First with hierarchies there's always the problem that at certain point you want two things to be in two different places. This is why "tags" are usually better than "folders" to organize things, see e.g. gmail.  

Second if we take the link you provided there are not so much toplevel descriptors which means that it lengthen the names without bringing much benefit except noise. More precisely, for me there are two things that needs to be distinguished:

1) A user looking for a library to solve a problem.
2) A user writing code with the library he found or reading code already written.

In case 1) a tagging system is a better way of finding what he's looking for and this doesn't actually happen in the language anyway. More likely he'll browse opam's html representation (opam recently added tags I'm sure they will eventually implement tag browsing in their html representation)

In case 2) the reader gets absolutely no benefit of these intermediate descriptors/hierarchies (e.g. unsurpisingly Data.Time.Calendar isn't just "Data"). He just need a quick way to access the leaves of the hierarchy. So the hierarchy itself is here again useless in the language, it's only noise.  

Keep it flat.

Daniel




More information about the Platform mailing list