We're making F# more normal as a language, says its creator

Loved by users, impenetrable to others, but 6.0 update aims to change that


F# designer Don Syme said this week that the new version, 6.0, aims to be "more normal as a language" in order to improve take-up.

There was a telling moment in the .NET Conf virtual event, just after the presentation of F# 6 from Syme and his colleague, principal program manager Kathleen Dollard. A developer asked: "What is the best way to do optional values in records in F#?"

Tireless .NET evangelist Scott Hanselman, with commendable honesty, acknowledged that "I know how to say the words but I don't know what they mean," while even Dollard was uncertain how to answer. "Just use the F# option value," said Syme. "Then you can create a helper method to create the record where you can take optional arguments."

'I know how to say the words, but I don't know what they mean'

'I know how to say the words, but I don't know what they mean'

The problem is that while those who know F# love the language, it is somewhat impenetrable to others. Several features in F# 6.0 are intended to address this. One is the indexing syntax. Until now, an array element was accessed by expr.[idx] with a dot between the expression and the index. Now, in F# 6, developers can write expr[idx] as they can in C#, Java or C.

"We made the revision for F# to be more normal as a language," said Syme in the presentation. "That dot was losing people for no reason. If you show F# machine learning code for example, to particular kinds of audiences, where you do a lot of indexing, a lot of slicing, the first thing they see is the dot." They say, 'I'm not going to listen any more'."

Along similar lines, there is a new task keyword. Prior to version 6.0, "async programming in F# is extremely nice, it has lots of lovely properties, but it differs from .NET tasks in some crucial ways. They are ways which created a lot of dissonance between async programming and .NET libraries which were using Tasks," said Syme.

The F# Async module includes methods like StartAsTask and AwaitTask to enable interoperability. Now in F# 6.0, "we decided to also let you do Task programming directly," said Syme. According to the official list of new features, "the performance of task {...} is much better" than using async.

"The themes of F# 6 are the same as the themes of F# all the way through," said Syme, these being "succinct, robust and performant." That said, Syme added that "we have changed the way we talk about F#," no longer as a functional language but "we let the properties of the kind of programming you can do with F#, which includes functional programming, and many other kinds of programming."

Other new features in F# 6.0 include resolved inconsistencies in indentation-aware syntax, more support for implicit conversions, new collection functions, and support for consuming interfaces with default implementations (a C# feature).

Tooling improvements include pipeline debugging, where pipelining is the passing of the output of one function to be the input to another. Pipeline debugging lets developers set breakpoints for intermediate stages in the pipeline.

The debugger will also now show the value of shadowed variables, meaning variables whose values are not visible because a new variable with the same name has been declared later.

There is also what Dollard calls "dramatic improvements to Compiler/IDE-tooling perf/scalability." In addition, F# 6.0 benefits from performance improvements in the .NET runtime.

F# emerged from Microsoft Research in Cambridge, starting with a post from Syme on the Caml mailing list in 2001 asking whether "there are people with some time to spare who would be keen to work with me toward a .NET version of OCaml?"

The full early history can be found here [PDF]. Does the F in F# stand for "functional"? "Sort of," Syme told us. "F is partly for 'System F', a core lambda calculus – but of course that calculus was named after Function. The F# community say 'F# is for fun' which is a cute pun on the keyword 'fun' too."

F# 1.0 appeared in 2005, and Syme made an impact in programming communities with demonstrations of how concise it was compared to most languages, in certain scenarios, for code that did the same thing. It soon won favour in the financial community because of its efficiency and because functional programming is less error-prone, avoiding potentially expensive bugs.

Barriers to wide adoption will remain, not least because F# project types in Visual Studio are limited to console, library, and web applications, compared to a full range of project types for C# or Visual Basic. There is support for .NET interactive notebooks, though, and typing dotnet fsi opens an interactive session anywhere the .NET SDK is installed.

F# is also notable for its good standing in the open-source community. The F# Foundation has a clear legal structure and the language evolves via RFCs, a well-established open process. F# also has excellent support for the cross-platform Visual Studio Code, via a set of crowdfunded tools called Ionide.

The language remains niche – although with an enthusiastic following. StackOverflow's annual survey puts usage at just 0.97 per cent of respondents, but turn to the "most loved" section and it scores 62.44 per cent, just above C#. Boosting its usage is a challenge, though the changes in F# 6.0 show that the community would love for .NET's best-kept secret to be better known. ®

Similar topics

Broader topics


Other stories you might like

  • Robotics and 5G to spur growth of SoC industry – report
    Big OEMs hogging production and COVID causing supply issues

    The system-on-chip (SoC) side of the semiconductor industry is poised for growth between now and 2026, when it's predicted to be worth $6.85 billion, according to an analyst's report. 

    Chances are good that there's an SoC-powered device within arm's reach of you: the tiny integrated circuits contain everything needed for a basic computer, leading to their proliferation in mobile, IoT and smart devices. 

    The report predicting the growth comes from advisory biz Technavio, which looked at a long list of companies in the SoC market. Vendors it analyzed include Apple, Broadcom, Intel, Nvidia, TSMC, Toshiba, and more. The company predicts that much of the growth between now and 2026 will stem primarily from robotics and 5G. 

    Continue reading
  • Deepfake attacks can easily trick live facial recognition systems online
    Plus: Next PyTorch release will support Apple GPUs so devs can train neural networks on their own laptops

    In brief Miscreants can easily steal someone else's identity by tricking live facial recognition software using deepfakes, according to a new report.

    Sensity AI, a startup focused on tackling identity fraud, carried out a series of pretend attacks. Engineers scanned the image of someone from an ID card, and mapped their likeness onto another person's face. Sensity then tested whether they could breach live facial recognition systems by tricking them into believing the pretend attacker is a real user.

    So-called "liveness tests" try to authenticate identities in real-time, relying on images or video streams from cameras like face recognition used to unlock mobile phones, for example. Nine out of ten vendors failed Sensity's live deepfake attacks.

    Continue reading
  • Lonestar plans to put datacenters in the Moon's lava tubes
    How? Founder tells The Register 'Robots… lots of robots'

    Imagine a future where racks of computer servers hum quietly in darkness below the surface of the Moon.

    Here is where some of the most important data is stored, to be left untouched for as long as can be. The idea sounds like something from science-fiction, but one startup that recently emerged from stealth is trying to turn it into a reality. Lonestar Data Holdings has a unique mission unlike any other cloud provider: to build datacenters on the Moon backing up the world's data.

    "It's inconceivable to me that we are keeping our most precious assets, our knowledge and our data, on Earth, where we're setting off bombs and burning things," Christopher Stott, founder and CEO of Lonestar, told The Register. "We need to put our assets in place off our planet, where we can keep it safe."

    Continue reading

Biting the hand that feeds IT © 1998–2022