On some recent evolutions of OCaml

Gabriel Scherer

Open World Forum, functional programming meetup, Oct 30

The programming language

OCaml: a pragmatic typed functional language.

ML family: statically typed, type inference. Algebraic datatypes and pattern-matching. GADTs (recent).
Unique stuff (polymorphic variants).

Side-effects: mutable state and exceptions.

Strong module system, but lacks type classes.

Compiled, quite fast for some use cases, despite a relatively simple compiler -- good representation choices and good home-made runtime.

Academia-born. Developed since 1985 at INRIA.
Free software.

Popularity, community, evolution

It's very hard to estimate usage and popularity of a programming language.

In the programmers media, people talk about Haskell (or Rust) more; it seems OCaml is not growing as fast.

Nevertheless, it has an active community of users that contribute code. (Feel free to join, we have regular meetups and hackatons in Paris)

Half a decade ago, people had the impression that the language was not evolving fast enough. This has changed.

What changed?

Effort: Industrial OCaml users invest into evolving the language and the community.

Tooling: we got a new package manager (OPAM) that created a consensus.

Dialogue: better communication between maintainers and the community.

A shrinking core distribution

Language changes

GADTs

immutable strings

first-class modules

Built-in extensions and annotations (less general preprocessing)

Compiler exports a library and helps tooling.

implicits?

A small detail

let rec read_all acc =
  match input_line () with
  | line -> read_all (line :: acc)
  | exception End_of_input -> List.rev acc

let read_all () = read_all []

.

Syntactic improvement over the exceptional syntax.

Is OCaml the first language to adopt effect handlers? :-)

A few recent-ish projects

Thanks. Questions?

If you wish to contribute: