What’s new in the F# programming language

The main behavioral change makes F# tuple types and System.Tuple types completely synonymous, while the Version 4.5 beta brings in Span

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

In mid-August 2018, Microsoft released the production Version 4.5 of F#, which supports the Span value type from .Net Core to improve code.

Current version: What’s new in F# 4.5

Span, aka Span<T>, enables the representation of contiguous regions in arbitrary memory. With Span, Microsoft wants F# to have better code generation particularly for byref-like constructions and full parity with .Net Core performance innovations. Interoperability with high-performance code also is a goal.

Span allows for safe use of performance-oriented constructs in a restrictive manner. For example, a developer cannot define an F# record type with a Span inside it, because Span is a byref-like type and thus can only be contained in other byref types.

The Span feature set in F# 4.5 includes:

  • The voidptr type.
  • Comprehensive safety checks to prevent unsound code.
  • The ability to produce IsReadOnly structs.
  • The ability to produce IsByRefLike structs.
  • inref<’T> and outref<’T> types, which are read- and write-only versions of byref<’T>.
  • The ability to write extension methods on byref<'T>inref<'T>, and outref<'T>.

To continue reading this article register now