ML (programming language)

acronym

programming

Kept in this browser · My desk

Stands for: Meta Language

The Meta Language of Robin Milner's Logic for Computable Functions (LCF) theorem prover at Edinburgh, from 1973, and its descendants such as Standard ML: statically typed functional languages with type inference.

The History of Standard ML lists static typing with type inference and polymorphic types among its defining features; Standard ML was formally defined in 1990 and revised in 1997.

What it is. ML, the Meta Language, began as the language for programming proofs in Robin Milner's Logic for Computable Functions (LCF) theorem prover at Edinburgh from 1973, and grew into a family of statically typed functional languages with type inference: Standard ML, Caml and OCaml, with ideas that passed into Haskell, Swift and Rust. It is not to be confused with machine learning.

From LCF. Mike Gordon's From LCF to HOL: a short history records that the original LCF was a proof-checking program developed at Stanford by Milner in 1972, "LCF" abbreviating "Logic for Computable Functions", Milner's name for a logic devised by Dana Scott in 1969. Around 1973 Milner moved to Edinburgh and started Edinburgh LCF with Lockwood Morris and Malcolm Newey. Two problems drove the design: Stanford LCF stored whole proofs, which exhausted memory, and its fixed set of proof commands could not be extended. For the first, Milner decided the system should remember only the results of proofs, the theorems; the steps were performed but not recorded, "like a mathematics lecturer using a small blackboard who rubs out earlier parts of proofs to make space for later ones". For the second, Milner, "ably assisted by Morris and Newey", designed a language in which users could program their own proof strategies: ML.

Types as the guarantee of proof. Milner's "brilliant idea", as Gordon puts it, was an abstract data type of theorems "whose predefined values were instances of axioms and whose operations were inference rules". "Strict typechecking then ensured that the only values that could be created were those that could be obtained from axioms by applying a sequence of inference rules - namely theorems." ML's type system was therefore not a convenience but the security of the prover: a theorem value could only come from a proof.

Inference. Milner's 1978 paper A Theory of Type Polymorphism in Programming described the polymorphic type discipline "incorporated in the LCF metalanguage ML", in use for nearly two years, with a checker that infers types nobody wrote and the theorem that "well-typed programs cannot 'go wrong'". ML let a compiler deduce types nobody wrote: a function that filters, squares and sums a list gets the type int list -> int on its own, and a function that works on any list gets a polymorphic type.

Standard ML. The History of Standard ML by David MacQueen, Robert Harper and John Reppy (the fourth History of Programming Languages conference, HOPL IV, June 2020) lists static typing with type inference and polymorphic types among its defining features, and stresses that a formal definition "was one of the explicit goals from the beginning of the project", with proofs such as the soundness of the type system. The first Definition of Standard ML appeared in 1990, and The Definition of Standard ML (Revised), by Milner, Mads Tofte, Robert Harper and David MacQueen, from the MIT Press in 1997.

The French branch. OCaml's own history says ML "was turned into a compiler in order to make it easier to use LCF on different machines" and grew into a full system by the 1980s. The first implementation of Caml appeared in 1987, created by Ascánder Suárez in the Formel project at the French research institute INRIA (Institut National de Recherche en Informatique et en Automatique) headed by Gérard Huet, continued by Pierre Weis and Michel Mauny; Xavier Leroy and Damien Doligez built Caml Light in 1990; and OCaml was written in 1996 by Leroy, Jérôme Vouillon, Doligez and Didier Rémy at INRIA.

Influence. ML's algebraic data types and pattern matching passed to OCaml, Haskell, Swift and Rust, whose reference credits Standard ML (SML) and OCaml for them. Its module system and its insistence on a formal definition also set a standard few languages have matched.

What goes wrong. Inference is not free: type errors can be reported far from their cause, because the checker discovers the conflict where two inferred types meet. And the name collides with machine learning in every search.

Neighbours. ML shares Lisp's functional roots, gave the type system its best-known theory, sits beside Prolog in the history of Edinburgh's proof systems, and is an ancestor of Rust. Brazilian practice says ML, Standard ML or OCaml.

Also known as: standard ml, sml, meta language, ocaml family

← Back to M Back to the glossary