What is F Sharp Programming

Programming language: F # 5.0 supports interactive programming with .NET 5

The .NET team has released the new major version of the functional programming language F #: Microsoft ships F # 5.0 together with .NET 5.0, which was released this week. The focus of the current release is on the interactive development of code and revised analytical functions. The basic functions are designed for the new .NET version 5.0, which succeeds the .NET Framework, .NET Core and Mono variants and aims to standardize the three previously separate Microsoft development strands.

Interactive programming with Jupyter Notebooks and nteract

F # 5.0 is the new standard version of the language for the Visual Studio (VS) development environment and the .NET SDK. Anyone who compiles a new or existing project with one of the two tools automatically uses version 5.0 from now on. According to the announcement in the .NET blog, Jupyter Notebooks and nteract also support the release, which makes interactive projects with F # possible. The new major version apparently masters the syntax for referencing packages. Package references then support native dependencies such as the machine-leaning framework ML.NET; F # developers can use them to load packages in Jupyter notebooks and in the notebooks from VS Code that are still in the preview stage.

A major innovation in F # 5.0 is string interpolation, which is designed to be similar to interpolated strings in C # and JavaScript: Developers can now apparently enter code in the "spaces" of a string in the string literal. According to the F # team's blog entry, typed interpolations are also possible, which can be used to force the interpolated context to correspond to a certain type. The format specifications correspond to the function.

Disclose type declarations

In order to protect their own logs against later changes in the source code when logging, F # developers can now use the new feature with which an assigned symbol can be resolved consistently. For example, month names can be anchored - calling up a 13th name would produce an error message in this case, since the name pool only contains twelve months. According to the editors, practically anything in F # can be used as "names", including type parameters.

F # 5.0 enables the disclosure of type declarations - the principle is roughly equivalent to opening a static class in C #. With the new command, developers should now be able to expose the static content of any type. Entries defined by F # can also be "opened" with it. This option is useful if, for example, you want to access the derivatives of a union without having to open the entire higher-level module.

Further innovations concern the performance of runtime and compiler, the slicing of data types in analytical work on data sets and computative expressions are used in F # 5 to model context-related calculations, the so-called "monadic arithmetic processes" of functional programming. A number of other features such as reverse indexes are in the preview stage in the starting blocks and will reach a stable state in future releases. The F # team plans to work on the open source infrastructure for the next version. It plans to improve some of the core tools. The last F # version 4.7 was released in September 2019 parallel to the then .NET Core 3.0 and required the .NET Standard 2.0. Since F # 4.7, the effective language version can be coordinated with the compiler.

Functional-first and multi-paradigm language

In 2017, Mads Torgersen, a program manager in the .NET team at Microsoft and lead designer for C #, commented on the strategy of the company's own .NET languages: At that time there was a departure from the "co-evolution strategy", since then the languages ​​have followed Visual Basic, C # and F # each have more individual development lines. F # is the functional counterpart to C # and is one of the multi-paradigm languages: F # is a statically typed functional-first language with features and idioms for functional, object-oriented and imperative programming. Examples of functional languages ​​are Elm, Elixir and Clojure, classically object-oriented (and mostly "general purpose") languages ​​such as Java, PHP and C #. However, the strict boundaries are blurring, and functional concepts are also finding their way here.

When changing strategy three years ago, Microsoft announced that it wanted to make F # the "best functional language". The type system is particularly powerful because it can infer the type of an expression or value without specifying type parameters. In practice this means that it is often not necessary to specify the types when using the language. Values ​​and functions can be linked to names for identification and assigned to them. These variables are then - in contrast to other languages ​​- immutable. Only at first glance does F # appear like a special language for mathematical algorithms - on closer inspection, a broader range of applications opens up. It was already noticeable before 2017 that F # had less active developers than C # and Visual Basic, but had strong support in the open source community.

Further information

More information on the release of F # 5.0 can be found in the detailed announcement in Microsoft's .NET blog. The F # team lists numerous code samples and provides instructions on how to install them in different environments. F # 5.0 is included in the new .NET 5.0 release and can be used under Windows with Visual Studio from version 16.8. In addition to the classic purchase via the current .NET SDK, installation is also possible in Jupyter notebooks and VS Code notebooks (preview) .

(sih)