F# is derived from the ML family of languages, part of the functional programming language tradition. However, F# is not simply a functional language: it is a multi-paradigm langauge that attempts to capture the best of both functional and object-oriented programming in the context of .NET. Furthermore, even when used as a purely functional language F# is remarkable for the sheer power of the libraries and tools available through .NET.
The distinctive features of all ML-family languages are strong static type checking, excellent type inference, lightweight and typesafe function types, safe and syntactically convenient discriminated unions. These core work together to allow for succinct yet efficient solutions to many programming problems, and repeatedly permit common patterns of coding to be abstracted very easily.
One way of looking at it is that the purpose of F# is to solve all of the 7 major problems described in Wadler's classic paper Why no one uses functional languages: Libraries, Portability, Availability, Packagability, Tools, Training and Popularity. Of these, F# solves the issues of libraries (by immediately giving high-quality, no-wrapper access to hundreds of .NET libraries), portability (the .NET bytecode is portable, e.g. the Mono project provides an implementation for many platforms), packagability (.NET assemblies are an excellent packaging mechanism) and tools (.NET tools for other languages nearly always work with F# as well). The remaining issues are partly solved by the fact that F# has a core design similar to that of OCaml, a popular functional language implementation for which a good amount of training material is available, and also that huge amounts of excellent training material for the .NET platform is available on the web.
In more detail, the aims of F# are as follows:
To implement the core features of an ML programming language on the .NET platform, focusing on language interoperability via typed compilation, and to provide the an ML implementation that can co-exist as a partner language in a multi-language setting ;
-
To bring the benefits of .NET and ML-style programming to the scientific, engineering and high-performance computing communities. This also provides a setting where we can write truly significant applications in an ML-like language, thereby enabling the research community to identify and solve the remaining issues that inhibit the uptake of modern languages in the context of these software ecosystems.
There are several key application areas for a language like F# on the .NET platform. In particular, such languages excel at mathematically-oriented programming, and, given the right libraries and visualization tools, a range of scientific and engineering tasks as well. These languages are also well known to be extremely powerful when used to implement sophisticated symbolic analyses such as hardware verification, software verification, optimization, machine learning and compilation.
You can read about many applications of F# on Don Syme's blog.
The minimal technical requirements for a powerful scientific and data-intensive .NET programming language are as follows:
-
High performance
-
Succinctness
-
Simplicity
-
Interactive scripting and visualization
-
A rich developer experience (intellisense, codesense, debug, tools)
-
Support for .NET component development
-
Easy, efficient access to .NET libraries
-
Alignment with key for emerging technical trends such as multi-core computing, web services and data-oriented meta-programming.
Here are some of the things that make F# highly distinctive in this arena:
-
Its inherent technical strengths as a multi-paradigm programming language, and in particular the added productivity benefits of functional programming.
-
The use of type inference and automatic generalization to achieve both succinctness and performance.
-
The F# toolset for interactive visualization and development
-
Its support for LINQ and LINQ-style meta-programming.
-
The support of Microsoft Research for a credible, stable reputation and as a focal point for the F# community and as a key source of high-impact users at Microsoft.
-
The inherent importance of functional programming in the emerging multi-core world.
F# is, technically speaking, neutral with respect to concurrency - it allows the programmer to exploit the many different techniques for concurrency and distribution supported by the .NET platform. However, functional programming is one of the primary known techniques for minimizing, tracking and isolating the use of mutable state, essential for emerging techniques such as software-transactional-memory.
F# can directly use multi-core programming libraries such as ParallelFX. F# also includes language and library support for asynchronous workflows, a technique to write reactive programs and asynchronous message passing agents in a natural and compositional style.
One of the striking features of F# is its combination of dynamic and static features. For example, F# Interactive provides a strikingly powerful dynamic compilation environment, where dynamically entered code is executed using the full performance power of high-quality native code.
Another key feature of dynamic languages is succinctness. As with previous versions of ML, F# manages to be as succinct as many dynamic languages through its use of type inference, but like-for-like computationally-intensive samples will typically execute faster than other dynamic language implementations.
F# permits the use of other dynamic techniques such as a universal 'object' type, runtime code generation, runtime inspection of the properties of values and the runtime analysis of type parameters.
F# doesn't share all the features of dynamic languages. For example, it is not yet easily hosted inside other applications. At a language level, some operations characteristic of dynamic languages are not permitted. Likewise, it doesn't directly target the Dynamic Language Runtime, though may do so in the future.
"ML" is a language design that has had several manifestations, from Edinburgh ML to Standard ML and through to the current SML '97 and OCaml languages. F# follows the tradition of the Caml design group who seek a balance between stability and innovation. Both F# and OCaml use a simple, elegant core language and add interesting extra features. For the past several years, Ocaml has been a de-facto standard in the applied ML programming. As such, F# takes the design of core OCaml as a starting point, but combines the enormous strengths of the core OCaml language with those of .NET.
LINKS
- http://caml.inria.fr/ - The CAML Language
- http://research.microsoft.com/fsharp/fsharp.aspx
Comments