jonnifyfsharp

Dive C0.1.3

F# is born

OCaml's core, retargeted to a managed runtime — the ML tradition, on .NET.

The line reaches the present in Don Syme's work at Microsoft Research in Cambridge. The F# project began around 2002 with a clear conception: OCaml for .NET — the ML core and syntax, retargeted to the Common Language Runtime, with full access to the .NET platform. This dive covers that founding idea, the syntax choices that smoothed it, and the road to F#'s first productised release in Visual Studio 2010.

C0.1.3 · part 1

Don Syme, generics, and the founding idea

Don Syme led the design of F# at Microsoft Research, Cambridge. He came to it from a closely related piece of work: with Andrew Kennedy, Syme had designed and built generics for .NET, which shipped with real runtime support in .NET 2.0 in 2005. That runtime support for parametric types is part of why F# can compile its ML-style generics efficiently rather than erasing them.

F# was conceived, in Syme's account, as OCaml for .NET: early F# was substantially compatible with OCaml's core, so a large class of OCaml programs could compile and run on the CLR. The aim was a functional-first but pragmatic language — functional by default, with full .NET interop and objects available when a problem calls for them.

designer
Don Syme, Microsoft Research, Cambridge.
project began
c. 2002.
earlier work
.NET generics (with Andrew Kennedy), shipped in .NET 2.0 (2005).
founding idea
OCaml for .NET — the ML core on the CLR, with full platform interop.
stance
functional-first, but pragmatic: objects and interop when needed.

A design slogan that runs through F#: make illegal states unrepresentable — model the domain so the type system rules out the states a program should never reach. The next chapters of the course build on exactly this.

OCaml beside F#: the shared core

Because F# started from OCaml's core, much of the everyday surface is the same — and where it differs, the difference usually buys F# something: lighter syntax, the pipe idiom, or the .NET platform. Select a feature to see its OCaml form beside its F# form, with one line on what F# kept or changed.

A feature in both languages · select one

OCaml core ML syntax + semantics + .NET platform CLR + libraries F# functional-first on .NET

OCaml

let add x y = x + y

F#

let add x y = x + y
The shared core. A simple function definition is byte-for-byte the same in both languages — this is the OCaml compatibility F# started from.

F# is OCaml's core, plus the .NET platform. The everyday shape carries over; the changes add the pipe, lighter syntax, and a runtime full of libraries to reach.

OCaml

A typed, functional ML dialect with records, unions, and a fast compiler — but no .NET.

F#

The same core on the CLR: [1; 2; 3] |> List.map f and any .NET API, in one language.

C0.1.3 · part 2

#light syntax, and the road to release

Early F# offered the verbose OCaml-style syntax, then added #light — the offside-rule, indentation-aware syntax that drops much of the punctuation and became the default way to write F#. It is why idiomatic F# reads cleanly, closer to the layout of the ML family than to the braces of C-style languages.

The releases came in steps. F# 1.0 arrived around 2005 from Microsoft Research. The first productised, first-class release was F# 2.0, shipped in Visual Studio 2010 with full tooling. Later, F# 3.0 (2012) introduced type providers — a mechanism for the compiler to surface an external data source as typed code, an F# innovation rather than an inheritance.

F#, in steps

~2002 project begins ~2005 F# 1.0 · from MSR 2010 F# 2.0 · VS 2010 2012 F# 3.0 · type providers
F# 2.0 · Visual Studio 2010 · the first first-class, productised release of the language
#light
the offside-rule syntax; lighter than OCaml-style, now the default.
F# 1.0
c. 2005, from Microsoft Research.
F# 2.0
Visual Studio 2010 — the first productised release.
F# 3.0
2012 — type providers, an F# innovation.

The line, completed

The module closes where it set out to arrive. The λ-calculus made functions the unit of computation; LISP made them data; the ML family made them typed without forcing the types to be written; and F# put that whole inheritance — OCaml's core — on the .NET runtime, reachable from any .NET library. Each trait F# is known for has a date and a source on this line.

That is the language lineage. The companion module, C0.2, follows the other thread the chapter opened: the .NET runtime itself — the CLR, the move to cross-platform .NET, and the open-source turn that carried F# to a wider community.

References

Sources

Related in this course