Skip to content
OCaml
EntityQ212587· pop 41· linked from 452 articles

OCaml ( , formerly Objective Caml) is a general-purpose, high-level, multi-paradigm programming language which extends the Caml dialect of ML with object-oriented features. OCaml was created in 1996 by Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy, Ascánder Suárez, and others.

Key facts

Programming language.name
OCaml
Programming language.logo
OCaml Logo.svg
Programming language.paradigms
Multi-paradigm: functional, imperative, modular, object-oriented
Programming language.family
ML: Caml
Programming language.designers
Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy, Ascánder Suárez
Programming language.developer
Inria
Programming language.typing
Inferred, static, strong, structural
Programming language.programming language
OCaml, C
Programming language.platform
IA-32, x86-64, Power, SPARC, ARM 32-64, RISC-V
Programming language.operating system
Cross-platform: Linux, Unix, macOS, Windows
Programming language.license
LGPLv2.1
Programming language.file ext
.ml, .mli
Programming language.influenced by
C, Caml, Modula-3, Pascal, Standard ML
Programming language.influenced
ATS, Rocq (former name: Coq), Elm, F#, F*, Haxe, Opa, Rust, Scala, Gleam
Programming language.wikibooks
OCaml

via Wikipedia infobox

Official website

Welcome to a World of OCaml

OCaml is a general-purpose, industrial-strength programming language with an emphasis on expressiveness and safety.

ocaml.org

Programming languages matter. They affect the reliability, security, and efficiency of the code you write, as well as how easy it is to read, refactor, and extend. The languages you know can also change how you think, influencing the way you design software even when you’re not using them. Generational garbage collection for automatic memory management. First-class functions that can be passed around like ordinary values, as seen in JavaScript, Common Lisp, and C . Static type-checking to increase performance and reduce the number of runtime errors, as found in Java and C . Parametric polymorphism , which enables the construction of abstractions that work across different data types, similar to generics in Java and C and templates in C++. Good support for immutable programming , i.e., programming without making destructive updates to data structures. This is present in traditional functional languages like Scheme, and it's also found in distributed, big-data frameworks like Hadoop. Type inference , so you don’t need to annotate every function parameter, return type, and variable. Instead, types are inferred based on how a value is used. Available in a limited form in C with implicitly-typed local variables and in C++11 with its auto keyword. Algebraic data types and pattern matching to define and manipulate complex data structures, also available in Scala and F . There is something transformative about having all these features together and able to interact in a single language. Despite their importance, these ideas have made only limited inroads into mainstream languages, and when they do arrive there, like first-class functions in C or parametric polymorphism in Java, it’s typically in a limited and awkward form. The only languages that completely embody these ideas are statically-typed, functional programming languages like OCaml, F , Haskell, Scala, Rust, and Standard ML. Among this worthy set of languages, OCaml stands apart because it manages to provide a great deal of power while remaining highly pragmatic. The compiler has a straightforward compilation strategy that produces performant code without requiring heavy optimisation and without the complexities of dynamic just-in-time (JIT) compilation. This, along with OCaml’s strict evaluation model, makes runtime behavior easy to predict. The garbage collector is incremental, (letting you avoid large GC-related pauses) and precise, meaning it will collect all unreferenced data (unlike many reference-counting collectors). Plus, the runtime is simple and highly portable. All of this makes OCaml a great choice for programmers who want to step up to a better programming language, and at the same time get practical work done. Xavier Leroy continued extending Caml Light with new features, which resulted in the 1995 release of Caml Special Light. This improved the executable efficiency significantly by adding a fast native code compiler that made Caml’s performance competitive with mainstream languages such as C++. A module system inspired by Standard ML also provided powerful facilities for abstraction and made larger-scale programs easier to construct. The modern OCaml emerged in 1996, when Didier Rémy and Jérôme Vouillon implemented a powerful and elegant object system. This object system was notable for supporting many common object-oriented idioms in a statically type-safe way, whereas the same idioms required runtime checks in languages such as C++ or Java. In 2000, Jacques Garrigue extended OCaml with several new features such as polymorphic methods and variants, as well as labeled and optional arguments. The last two decades have seen OCaml attract a significant user base, and language improvements have been steadily added to support the growing commercial and academic codebases. By 2012, the OCaml 4.0 release had added Generalised Algebraic Data Types (GADTs) and first-class modules to increase the flexibility of the language. Since then, OCaml has had a steady,

Read more on their site →

Excerpt from the official site · 8,559 chars · not written by Vinony

Wikidata facts

Official website
ocaml.org
Show 8 more facts
software version identifier
5.4.0
file extension
mli
Commons category
OCaml
inception
1996-01-01
official demo URL
ocaml.org/play
user manual URL
ocaml.org/manual
official forum URL
discuss.ocaml.org
Sources (8)

via Wikidata · CC0

~25 min read

Article

27 sections
Contents
  • Philosophy
  • History
  • Development of ML (Meta Language)
  • First implementation
  • Caml Light
  • Caml Special Light
  • Objective Caml
  • Ongoing development
  • Features
  • Code examples
  • Hello World
  • Option
  • Summing a list of integers
  • Quicksort
  • Birthday problem
  • Church numerals
  • Arbitrary-precision factorial function (libraries)
  • Triangle (graphics)
  • Fibonacci sequence
  • Higher-order functions
  • Derived languages
  • MetaOCaml
  • Other derived languages
  • Software written in OCaml
  • Users
  • References
  • External links

OCaml ( , formerly Objective Caml) is a general-purpose, high-level, multi-paradigm programming language which extends the Caml dialect of ML with object-oriented features. OCaml was created in 1996 by Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy, Ascánder Suárez, and others.

The OCaml toolchain includes an interactive top-level interpreter, a bytecode compiler, an optimizing native code compiler, a reversible debugger, and a package manager (OPAM) together with a composable build system for OCaml (Dune). OCaml was developed first in the context of automated theorem proving, and is used in static analysis and formal methods software. Beyond these areas, it has found use in systems programming, web development, and specific financial utilities, among other application domains.

Gallery (3)

Connections

Categories