This page describes OCaml version 4.02.3, released on 2015-07-27. Go here for a list of all releases.
Three previous minor versions were released: 4.02.0 on 2014-08-29, 4.02.1 on 2014-10-14 and 4.02.2 on 2015-06-17. Links below point to 4.02.3 files. See here for all 4.02.* files.
Some of the highlights in release 4.02 are:
In a first step towards making strings immutable, a type bytes of mutable byte arrays and a supporting library module
Byteswere introduced. By default,
bytesis a synonym for
string, so existing code that mutates values of type
stringstill compiles, with warnings. Option
-safe-stringseparates the types
bytes, making strings immutable.
matchconstruct was extended to discriminate not just on the value of its argument expression, but also on exceptions arising out of the evaluation of this expression. This solves an old problem: in a
let x = a in b, catch exceptions raised by
abut not those raised by
Module aliases (giving an alternative name to an existing module or compilation unit, as in
module M = AnotherModule) are now tracked specially by the type system and the compiler. This enables not only more precise typing of applicative functors, but also more precise dependency analysis at link-time, potentially reducing the size of executables.
Annotations can now be attached to most syntactic elements of OCaml sources (expressions, definitions, type declarations, etc). These annotations are used by the compiler (e.g. to warn on uses of functions annotated as deprecated) but also by "ppx" preprocessors, to guide rewriting of abstract syntax trees.
Extensible data types can be declared (
type t = ..) then later extended with new constructors (
type t += A of int). This generalizes the handling of the exn type of exception values.
Functors and functor applications can now take a special () argument to force generativity of abstract types.
New toplevel directives
#show_modules, etc, to query the toplevel environment.
ocamlopt-generated code is improved on some programs through more aggressive constant propagation, two new optimization passes (dead code elimination and common subexpression elimination), better compilation of pattern-matching over strings, optimized representation of constant exceptions, and GC tuning for large memory heaps.
The format strings argument of
printffunctions are now represented as a GADT. This speeds up the
printffunctions considerably, and leads to more precise typechecking of format strings.
The native-code compiler now supports the AArch64 (ARM 64 bits) architecture.
The Camlp4 preprocessor and the Labltk library were split off the distribution. They are now separate projects.
For more information, please consult the comprehensive list of changes.
Source tarball (.tar.gz) for compilation under Unix (including Linux and MacOS X) and Microsoft Windows (including Cygwin).
Also available in .tar.xz format.
OPAM is a source-based distribution of OCaml and many companion libraries and tools. Compilation and installation are automated by powerful package managers.
You also have read-only SVN access to the working sources and to all previous public releases.
The INSTALL file of the distribution provides detailed compilation and installation instruction.
Binary distributions for CentOS, Debian, Fedora, RHEL, Ubuntu are available here.
Cygwin-based native Win32 port. A self installer. The interactive loop comes with a simple graphical user interface. Some features require the Cygwin environment, which the installer can fetch for you. However, the compilers are, and generate true Win32 executables, which do not require Cygwin to run.
Microsoft-based native Win32 port. No binary distribution available yet; download the source distribution and compile it.
Cygwin-based port. Requires Cygwin. No graphical user interface is provided. The compilers generate executables that do require Cygwin. The precompiled binaries are part of the Cygwin distribution; you can install them using the Cygwin setup tool. Alternatively, download the source distribution and compile it under Cygwin.
Microsoft-based native Win64 port Same features as the Microsoft-based native Win32 port, but generates 64-bit code. No binary distribution available yet; download the source distribution and compile it.
Precompiled binaries for Solaris
Available at sunfreeware.com.
Additionally, the following projects allow you to compile OCaml code to targets traditionally associated with other languages:
The ocaml-java project, an OCaml to Java compiler (stable)
The user's manual for OCaml can be:
downloaded as a single tarball of Emacs info files,
an enhanced version which marks up differences to OCaml 4.01 can also be browsed online.
All the files are also available in this directory, along with their MD5 checksums.
OCaml is Free Software, copyright INRIA, licensed under a combination of the QPL and the LGPLv2 (with a special exception on static linking). See the full license. Members of the OCaml Consortium benefit from a more liberal license (BSD-like).