- Tech know how online

F sharp (F#)

F-Sharp (F#) is a NET-compliantlanguage from Microsoft, which is assigned to the functional programming languages, but at the same time offers object-oriented and imperative possibilities. This allows components written in F-Sharp (F#) to easily interact with those written in C++harp (C#), Visual Basic, and C++. F# has a significantly different syntax than these languages, and leans heavily on the structures of Ocaml and ML in this regard. The fundamental properties of the language are described by the Common Language Specification( CLS). F# is particularly suitable due to the language concept for mathematical computations, thus functional connections

Originally approached as a research project inthe past, F# was then further developed and made available as an independent programming language, initially as an extension to Visual Studio 2008. Subsequently, F# was then integrated into the standard scope of Visual Studio 2010.

The concept of functional programming was already taken up in the 1950s with LISP, and further refined with the programming languages Erlang and Haskell in the 1990s. The goal was to create a uniform programming environment for initially scientific tasks.

F-Sharp for functional, imperative and object-oriented programming

F-Sharp is not exclusively designed for functional programming, also imperative and object-oriented programming are possible. Provided that the aspect of the efficiency is neglected, one can therefore quite with F# complete applications - with diagram, user interface, file IO, class concept etc. - create. - create. But in F# programs, the .NET framework can be used as a unified platform; for example, C-Sharp and Visual Basic can be used for the graphical user interface( GUI) and F# for the mathematical part of an application. The organization and coordination of the various components is ensured by the common runtime environment - the Common Language Runtime( CLR). When implementing an overall system, the solution of a specific detailed task can thus be given priority.

F# integrates among other things the following language features:

  • Variables and functions whose type is automatically determined by inference,
  • Variants (enumerations) and generics,
  • lists and arrays are generic elements,
  • Anonymous, normals and nested functions,
  • So-called tuples denote a container for a certain number of elements, which can be of different types,
  • Pattern matching, which is similar to"" constructs in other languages, subsequent use in patterns is possible,
  • Exceptions analogous to the concept of other languages and
  • parallel programming and asynchronous execution.
The Common Language Specification (CLS)

The Common Language Specification (CLS)

The concept of F# is based on the Common Language Specification (CLS) from Microsoft. Therefore, the compiler for F# first translates the F# code into a language-independent intermediate code called MSIL (Microsoft Intermediate Language) code. The common language runtime (CLR) then contains thejust-in-time ( JIT) compiler, which then translates the MSIL code into native code for final execution. Also provided is "fsi", an F# interpreter for interactive execution of F# code.

The areas of use for F# are mathematical tasks in science, engineering, financial and business mathematics, and general mathematics such as financial or data analysis, data modeling, or elaborate computations. The advantages of F# when used in this context are certainly that

  • the program code becomes significantly more efficient - i.e. shorter and more compact,
  • by missing type variety and side effects conditionally, extremely safe program code can be developed as well as
  • by the functional paradigm a simplification of the parallel and asynchronous programming is possible in relation to C#.

Englisch: F sharp - F#
Updated at: 29.10.2013
#Words: 555
Links: network entity title (OSI) (NET), functional programming, object (O), C++, syntax
Translations: DE

All rights reserved DATACOM Buchverlag GmbH © 2024