News

Microsoft: 'We Are Finished with F# 5'

While highlighting new development work on Microsoft's F# programming language alongside the latest .NET 5 preview, the company announced that, except for one minor enhancement, "we are finished with F# 5!"

F# is the open source, cross-platform, functional-first counterpart for C#, used for complex computing use cases like interactive Big Data analytics and more, officially stewarded by the F# Software Foundation but created and driven by Microsoft.

Microsoft says features of F# include:

  • Lightweight syntax
  • Immutable by default
  • Type inference and automatic generalization
  • First-class functions
  • Powerful data types
  • Pattern matching
  • Async programming

That aforementioned minor enhancement is scheduled for an upcoming release candidate (RC), but otherwise further development will focus on bug fixes and addressing high-priority feedback from developers.

Here's a summary of how Microsoft described the latest updates on F# 5 alongside the recent .NET 5 Preview 8:

  • String interpolation: This highly requested feature allows for evaluation of a string literal containing one or more placeholders to be filled in later, or, as Microsoft said, "F# interpolated strings are fairly similar to C# or JavaScript interpolated strings, in that they let you write code in 'holes' inside of a string literal." This was missing for years because the $ symbol used for string interpolation was reserved.

    Although it had an initial design early on, "The design has undergone a lot of discussion over the years, but finally a breakthrough on how to best handle it was made by Yatao Li, who also supplied an initial implementation," explained Phillip Carter, program manager, .NET and Languages, in a blog post last week.

    • Support for nameof is now complete: Carter said, "nameof resolves the symbol it's being used for and produces a name that represents what it's called in F# source. This is useful in various scenarios, such as logging, and protects your logging against changes in source code."
    • Open type declarations: This new feature lets developers use open to expose static contents inside of any type. Carter said it's similar to Open Static Classes in C# and added, "Additionally, you can open F#-defined unions and records to expose their contents. This can be useful if you have a union defined in a module and want to access its cases, but don't want to open the entire module."
    • Overloads of custom keywords in computation expressions: Developers, especially library and framework authors, can improve the expressiveness of components they create by defining well-known members and forming a domain-specific language (DSL) for a domain being used. "We've enhanced computation expressions to allow for Applicative forms already," Carter said. "This time, Diego Esmerio and Ryan Riley contributed a design and implementation to allow for overloading custom keywords in computation expressions."
    • Interfaces can be implemented at different generic instantiations: This enhances interface functionality in F# by enabling developers to implement the same interface at different generic instantiations, said Carter, who credited Lukas Rieger for contributing an initial design and implementation.

    Going forward, in addition to addressing developer feedback and fixing bugs, Carter said the F# team will work to improve its engineering system in the F# development repository on GitHub, focusing on testing infrastructure to make it easier for contributors to work on the project.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

Subscribe on YouTube