F Sharp (programming language)

This is an old revision of this page, as edited by Kesla (talk | contribs) at 23:20, 15 November 2005 (correct Gtk#-link). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

F# (pronounced F sharp) is a mixed functional and imperative programming language for the Microsoft .NET platform. F# was developed by Don Syme at Microsoft Research, and has a core language that is similar to that of the Caml language (itself a member of the ML programming language family).

A strength of F# is its setting within .NET. A key design aim is seamless .NET interoperability, both via direct use of .NET APIs from F# and authorship of natural .NET components in F#. Consequently, the main F# libraries are the .NET libraries themselves (e.g. DirectX, Windows Forms, and ASP.NET, as well as alternatives like Gtk#). A Visual Studio plugin provides a graphical development environment, including features such as background type-checking with feedback under the mouse, which is extremely helpful for those unfamiliar with type inference.

F# also provides a standard library of its own, designed to be largely compatible with the OCaml standard library. Since the two languages also share a common language subset, it can thus be quite practical to compile a single codebase with both. This enables core Caml code to be ported to the .NET world, and core F# code to run with OCaml. Maintaining this basic compatibility is one of the primary goals of the project.

As a research project, F# demonstrates how .NET enables interoperability between different programming paradigms. It showcases a set of extensions to .NET's intermediate language IL, called ILX, which demonstrate how a strict curried functional language may be compiled efficiently.

As of June 2005, F# was in the beta stage of development.

An example follows:

let x = 3 + (4 * 5)
let res = (if x = 23 then "correct" else "incorrect")