Microsoft Announces F# 4.5

Microsoft has announced the general availability of F# 4.5 which can be acquired by users through .NET SDK (2.1.400 or higher) and Visual Studio 2017 update 15.8.

Microsoft has announced the general availability of F# 4.5 which can be acquired by users through .NET SDK (2.1.400 or higher) and Visual Studio 2017 update 15.8.
Here is the list of several features -
Versioning Alignment
The first thing that has changed in F# 4.5 is that it’s higher than F# 4.1. This F# 4.5 is higher in the F# language version, FSharp.Core binary version, and FSharp.Core NuGet package.
Source: Microsoft
Side-by-side F# compilers deployed by Visual Studio
F# 4.5, the compiler SDK version, has 10.2. by installing the Visual Studio. The solution to these sorts have problems is for Visual Studio to install the F# bits it carries side-by-side.
Accounting for the change on Windows builds servers
F# Compiler SDK MSI singleton helps in building servers through Visual Studio Build Tools SKU and .NET SDK.
Span support
The F# 4.5 has several new Span feature in .NET Core 2.1 features including;
  • The voidptr type.
  • The NativePtr.ofVoidPtr and NativePtr.toVoidPtr functions in FSharp.Core.
  • The inref<'T> and outref<'T>types, which are read-only and write-only versions of byref<'T>, respectively.
  • The ability to produce IsByRefLike structs (examples of such structs: Span<'T>and ReadOnlySpan<'T>).
  • The ability to produce IsReadOnly structs.
  • Implicit de-reference of byref<'T> and inref<'T> returns from functions and methods.
  • The ability to write extension methods on byref<'T>, inref<'T>, and outref<'T>(note: not optional type extensions).
  • Comprehensive safety checks to prevent unsoundness in your code.
  • The main goals for this feature set are:
  • Offer ways to interoperate with and produce high-performance code in F#.
  • Full parity with .NET Core performance innovations.
  • Better code generation, especially for byref-like constructs.
Safety rules for byrefs
It helps in making the low-level code in the style of pointer manipulation safe and predictable.
Some of the safety rules -
  • A let-bound value cannot have its reference escape the scope it was defined in.
  • byref-like structs cannot be an instance or static members of a class or normal struct.
  • byref-like structs cannot be captured by any closure construct.
  • byref-like structs cannot be used as a generic type parameter.
Bug fixes that are not backward compatible
The two bugs fixes are compatible with F# 4.1 code which deals with consuming C# 7.x ref returns and performs “evil struct replacement”.
F# enumeration cases emitted as public
It has emitted F# enumeration cases as public under all circumstances running performance tools on F# code.
Better async stack traces
It starts with F# 4.5 and FSharp.Core 4.5.0 for async computation expressions.
Development process
F# 4.5 has been developed through an open RFC (requests for comments) process with the help of F# 4.5 RFCs and FSharp.Core 4.5.0 RFCs
The company mentions that there is no fixed roadmap but there is a list of features that the company has given priority to.
  • Nullability and compile-time enforced null-safety for reference types.
  • Anonymous Record types.
  • A task { } computation expression.
To learn more, you can go through the official announcement