Caml is a general-purpose programming language, designed with program safety and reliability in mind. It is very expressive, yet easy to learn and use. Caml supports functional, imperative, and object-oriented programming styles.
The Caml language has been developed since 1985 at INRIA by the Formel, Cristal and Gallium teams. Caml Light, which was developed in the early 1990s, is still in use today, especially in education. OCaml offers a richer programming language as well as efficient native code compilers for many architectures. A more detailed history of Caml is available.
Strengths
Both implementations of Caml offer:
- A powerful type system, equipped with parametric polymorphism and type inference. For instance, the type of a collection can be parameterized by the type of its elements. This allows defining some operations over a collection independently of the type of its elements: sorting an array is one example. Furthermore, type inference allows defining such operations without having to explicitly provide the type of their parameters and result.
- User-definable algebraic data types and pattern matching. New algebraic data types can be defined as combinations of records and sums. Functions that operate over such data structures can then be defined by pattern matching, a generalized form of the well-known switch statement, which offers a clean and elegant way of simultaneously examining and naming data.
- Automatic memory management, thanks to a fast, unobtrusive, incremental garbage collector.
- Separate compilation of stand-alone applications. Portable bytecode compilers allow creating stand-alone applications out of Caml Light or OCaml programs. A foreign function interface allows Caml code to interoperate with C code when necessary. Interactive use of Caml is also supported via a “read-evaluate-print” loop.
In addition, OCaml features:
- A sophisticated module system, which allows organizing modules hierarchically and parameterizing a module over a number of other modules.
- An expressive object-oriented layer, featuring multiple inheritance and parametric classes.
- Efficient native code compilers. In addition to its bytecode compiler, OCaml offers a compiler that produces efficient machine code for many architectures.
For more explanations, read our overview of the Caml language and tools, see Yaron Minsky's OCaml for the Masses white paper, or have a look at a hundred lines of Caml.
A Widely Used Programming Language
The Caml language was initially used to develop applications that involve symbolic computation: automatic theorem provers, compilers and interpreters, program analyzers, etc. It is now used to develop software in many other application areas. This is illustrated by our list of selected success stories.
The Caml language is widely used for teaching programming. It is also used inside academic projects in Europe, Asia, and the Americas. Several large corporations develop significant industrial projects in OCaml: these include Dassault Systèmes, Microsoft, IBM, and CEA (Commissariat à l'Énergie Atomique).
The Caml consortium offers industrial and academic partners a formal framework for participating in the development, maintenance, and evolution of Caml. Partners also enjoy very liberal licensing conditions regarding the Caml software distribution.
How to Get the Caml Compilers?
The Caml compilers developed at INRIA are Open Source software. They are available free of charge.
- You can download the latest versions off this site.
- Several Linux distributions, such as Debian, Fedora and Red Hat, contain OCaml.