News

Microsoft's F# Functional Programming Language Shaped by Open Source Community

Much has been made of Microsoft's embrace of open source and shift toward interoperability and collaboration, and that trend is exemplified in the new preview release of F#.

F# is a functional programming language created by Microsoft some 13 years ago, now officially under the direction of the F# Software Foundation.

While Microsoft remains the primary development driver behind the language, the company shouted out to open source community contributions that are helping shape the language -- with its blessing and encouragement -- in announcing a preview of F# 4.5 last week.

"F# 4.5 has been developed entirely via an open RFC (requests for comments) process, with significant contributions from the community, especially in feature discussions and demonstrating use cases," said the company's F# guru Phillip Carter.

As noted, Carter and his team at Microsoft are the primary developers of the language, though its code is parked in various F# Software Foundation code repositories on GitHub.

There, those aforementioned RFCs can be examined, resulting from a process in which developers interested in furthering the language go to F# Language Suggestions to submit ideas, which are then discussed and voted on.

"Ideas which get 'approved in principle' get an RFC entry based on the template, and a corresponding RFC discussion thread," says the GitHub F# Language Design RFCs site.

Carter invited developers to check out the RFCs that helped shape F# 4.5, corresponding to F# 4.5 RFCs and FSharp.Core 4.5.0 RFCs, the latter related to Microsoft's new .NET Core/.NET Standard initiatives that make .NET Framework more modular, portable and cross-platform.

On those repositories are several RFCs ranging from "there should be a syntatic sugar, called match!, that is equivalent to let! followed by match" to "allow effective consumption of APIs using Span, Memory and ref-returns."

The latter RFC adds F# support for the new Span feature in .NET. That alignment with the new Span feature in .NET Core 2.1 was described by Carter as "the largest piece of F# 4.5."

Carter also goes on to discuss the new match! keyword that he says somewhat shortens a lot of common boilerplate code.

That such community suggestions make it into the final F# language design isn't an accident, as Microsoft early on emphasized the open source community approach to developing the language.

For example, in "The .NET Language Strategy" published last year, the F# section includes this:

We will enable and encourage strong community participation in F# by continuing to build the necessary infrastructure and tooling to complement community contributions. We will make F# the best-tooled functional language on the market, by improving the language and tooling experience, removing road blocks for contributions, and addressing pain points to narrow the experience gap with C# and VB. As new language features appear in C#, we will ensure that they also interoperate well with F#. F# will continue to target platforms that are important to its community.

This focus on community contributions appears to be paying off, as the July 2018 TIOBE Index, which measures programming language popularity, noted that "F# leaped 19 places to position 36."

Besides the major Span functionality mentioned above, Carter explains many other new features in the F# 4.5 preview, including "F# enumeration cases emitted as public," "better async stack traces," "safety rules for byrefs" and more.

These features build on a host of other functionality introduced in May with Visual Studio 2017 15.7, which featured improvements to the F# compiler and core library, tooling and infrastructure, bringing the language more up to par with C#.

That improvement train continues in the new preview release. And even though it's dubbed a preview, the release is basically what you'll get in F# 4.5.

"This preview is very, very stable," Carter said. "In fact, after extensive testing, we feel that it's stable enough for us to consider it a proper release, but due to the timing of the .NET SDK and Visual Studio releases, we're releasing it now as a preview. Soon, when Visual Studio 2017 update 15.8 and the corresponding .NET Core 2.1 SDK update release, we will declare F# 4.5 as fully released and it will be fully included in both places."

Meanwhile, developers interested in seeing in what directions the community will be driving the language going forward can check out the F# Suggestions site on GitHub.

However, note that there is currently a backlog of approved ideas, and the top five suggestions that boast the most "thumbs up" reactions all stem from 2016.

As far as a roadmap for the language going forward, Microsoft says the closest approximation is the list of approved-in-principle items.

About the Author

David Ramel is the editor of Visual Studio Magazine.

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.