Microsoft Aims F# at Machine Learning
Microsoft has updated its open source, cross-platform F# language for functional programming, adding new functionality and positioning it to tackle machine learning projects in the future.
In announcing the F# 4.6 update to the 14-year-old language, Microsoft detailed new features such as Anonymous Record types and previewed future work including the release of F# 5.0 and .NET Core 3.0, along with F# Interactive on .NET Core.
It then explained the third big milestone coming up: F# for machine learning. Although F# can already be used for Microsoft's ML.NET machine learning framework (just updated itself to release candidate status), there's more machine learning functionality in the works.
"Finally, we're also devoting significant time in developing a compelling offering for using F# to do machine learning. In addition to being supported on ML.NET, we're working towards a world-class experience when using F# and TensorFlow," Microsoft said.
The TensorFlow.FSharp GitHub project says it's a work in progress that features two components:
- TensorFlow.FSharp: An F# API for TensorFlow
- FM: A prototype of a DSL "F# for AI Models." This currently executes using TensorFlow.FSharp but could have additional backends such as DiffSharp.
"TensorFlow shape checking and shape inference tie quite nicely into the F# type system and tools, which we feel is a differentiator when compared to using Python, Swift, or Scala," the March 29 F# 4.6 announcement post continued. "This is still an active research area, but over time we expect the experience to become quite solid as F# Interactive experiences on .NET Core also shape up."
F# Interactive (fsi.exe) is used to run F# code interactively at the console, or to execute F# scripts.
As far as F# 4.6, Microsoft said the primary focus of the update is to boost performance, especially for medium-to-large sized solutions. Part of that work involved removing a workaround to a previous IntelliSense bug that actually "resulted in horrible performance characteristics."
"Other work included significant reductions in cache sizes, significant reductions in allocations when processing format strings, removing ambient processing of identifiers for suggestions when encountering a compile error, removing LOH allocations for F# symbols when they are finished being typechecked, and removing some unnecessary boxing of value types that are used in lots of IDE features," Microsoft said.
F# coders should also be aware of the increased cadence of F# tooling, including F# tools for Visual Studio, that will correspond to Visual Studio releases. "With this in mind, you can think of the Visual Studio 2019 release and future updates as a continuous evolution of F# tooling," Microsoft said.
The F# development process relies heavily upon open source community volunteers, and Microsoft noted that F# 4.6 was developed entirely through the open requests for comments (RFC) process, with F# 4.6 RFCs and FSharp.Core 4.6.0 RFCs available on GitHub.
David Ramel is the editor of Visual Studio Magazine.