Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Wanted: your feedback on the hierarchy of OCaml Batteries Included
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-11-18 (12:39)
From: David Teller <David.Teller@u...>
Subject: Re: [Caml-list] Wanted: your feedback on the hierarchy of OCaml Batteries Included
On Tue, 2008-11-18 at 12:34 +0100, Daniel Bünzli wrote:
> Le 18 nov. 08 à 11:29, Erkki Seppala a écrit :
> > For example I prefer using the least amount of opening of modules,  
> > to make it easier to see where the values come from
> Same here. This is why I'm a little bit sceptical about this hierarchy.
> With the current standard library if I suddenly want to use  
> Int32.of_int, I know I just need to type Int32.of_int in my source.  
> With your proposal I need to remember that it is in Data.Numeric and  
> go at the beginning of my file to open it or write  
> Data.Numeric.Int32.of_int, to me this brings bureaucracy without any  
> benefit. And lack of bureaucracy is one of the reasons I like ocaml  
> (and dislike java for example).

I forgot to answer that part.

In Batteries, for the moment, we decided to keep the module names of the
base library as shortcuts to our new modules. Consequently, you can
still write your [Int32.of_int] in addition to our new [Int32.print],
etc. The old modules are still available as submodules of [Legacy], if

Should you wish to flatten the complete hierarchy, assuming that it's
possible and that there are no collisions on names, that's also
something which you can do quite easily. We even provide some syntactic
sugar for this. It's just the matter of writing a file
along the lines of 

module  Array                = Data.Mutable.Array
module List                  = Data.Persistent.List
module PosixThreads = Control.Concurrency.Threads.Threads
module PosixMutex      = Control.Concurrency.Threads.Mutex
module CoThreads        = Control.Concurrency.CoThreads.Threads
module ArrayExn          = Data.Mutable.Array include ExceptionLess 
    (*syntactic sugar*)
module ArrayLabels    = Data.Mutable.Array include Labels
module ArrayCapExn    = Data.Mutable.Array.Cap include ExceptionLess
module ArrayCapLabels= Data.Mutable.Array.Cap include Labels

I personally don't like name [ArrayCapLabels] but I can't think of any
better name to represent this once we have removed any hierarchy.

I personally prefer the hierarchy but, once again, the majority may
disagree. So if you believe this is better, the next logical step would
be to design a full and consistent list of modules including all the
modules which already appear in the current version of Batteries, and
with some space left for OCamlnet, OCamlnae, Reins, Camomile, ULex,
Camlp4, CoThreads and a few others. I truly mean it, if you can provide
us with something you consider more comfortable and as future-proof, we
may adopt it.


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