Platinum Partner
dotnet,languages,ocaml

OCaml, Where Art Thou?

A new point release for Objective Caml, the main implementation of Caml, has arrived this month with a surprising amount of new features.  OCaml combines functional, imperative, and object-oriented programming under an ML-like type system.  Languages such as F# and Scala were influenced by OCaml.

Here are some of the main new features in OCaml 3.12


  • Polymorphic recursion is now supported by using explicit type declarations on the recursively-defined identifiers.
  • First-class module support: module expressions can be embedded as values of the core language, and then manipulated like any other first-class value.  They are then projected back to the module level.
  • New operator to modify a signature a posteriori: S with type t := tau denotes signature S where the t type component is removed and substituted by the type tau elsewhere.
  • New notations for record expressions and record patterns: { lbl } as shorthand for { lbl = lbl }, and { ...; _ } marks record patterns where some labels were intentionally omitted.
  • Local open let open ... in ... now supported by popular demand.
  • Type variables can be bound as type parameters to functions; such types are treated like abstract types within the function body, and like type variables (possibly generalized) outside.
  • The module type of construct enables to recover the module type of a given module.
  • Explicit method override using the method! keyword, with associated warnings and errors.

Features like first class modules and the destructive signature operations should both make it easier to write libraries in OCaml.  You can find more changes in the compiler and libraries here.

The source and binaries are available here.  Binaries are available for Windows, Mac OS X, Linux, and Solaris.
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}