Previous Contents Next

Categorization and Use of the Libraries

The libraries in the Objective CAML distribution fall into three categories. The first contains preloaded global declarations. The second is called the standard library and is subdivided into four parts: Finally there are the libraries in the third group that generally extend the language, such as the Graphics library (see chapter 5). In this last group you will find libraries dealing with the following areas: regular expressions (Str), arbitrary-precision math (Num), Unix system calls (Unix), lightweight processes (Threads) and dynamic loading of bytecode (Dynlink).

The I/O and the system interface portions of the standard library are compatible with different operating systems such as Unix, Windows and MacOS. This is not always the case with the libraries in the third group (those that extend the language). There are also many independently written libraries that are not part of the Objective CAML distribution.

Usage and naming
To use modules or libraries in a program, one has to use dot notation to specify the module name and the object to access. For example if one wants to use a function f in a library called Name, one qualifies it as Name.f. To avoid having to prefix everything with the name of the library, it is possible to open the library and use f directly.


open Name

From then on, all the global declarations of the library Name will be considered as if they belonged to the global environment. If two declarations have the same name in two distinct open libraries, then only the last declaration is visible. To be able to call the first, it would be necessary to use the point notation.

Previous Contents Next