Paul Krill
Editor at Large

Fable F#-to-JavaScript tool integrates with Microsoft .Net Core SDK

news
Mar 23, 20172 mins

Fable uses the Babel compiler to make JavaScript a back end for Microsoft's F# functional programming language

pile of tools blue duotone
Credit: Thinkstock

Fable, a compiler that enables Microsoft’s F# “functional first” programming language to emit JavaScript, has reached a 1.0 beta stage, featuring integration with Microsoft’s .Net Core SDK.

Leveraging the Babel JavaScript compiler, Fable makes JavaScript a back end for F# without having to compile to .Net bytecode. The beta release has .Net Core serving as an open source implementation of .Net for Windows, Linux, and Mac.

“Also, as Fable 1.0 relies on the new F# project format, we may wait until it is supported in Visual Studio 2017 — currently the new .fsproj is only supported in Ionide — but hopefully that will take only a few weeks,” said Alfonso Garcia-Cano, Fable’s lead developer.

The beta release also features an improved approach to project files. Developers will see a list of files, references, and CLI tools that can be easily edited without fear of breaking anything in a build, according to Garcia-Cano. The .Net Core SDK accepts references for CLI tools, and with a project file running “dotnet restore,” developers can run Fable commands, prefixed with “dotnet fable.”

In Fable 1.0, curried lambdas are no longer compiled as nested functions. This situation had caused confusion and forced users to convert the lambdas into delegates before sending them to JavaScript. Instead, the 1.0 version has the compiler detecting whenever more or fewer arguments than expected are being applied to a function, with a nested function created ad hoc if necessary. If this guess is too difficult, Fable will create a dynamic lambda to check the number of applied arguments in runtime.

Also with the beta release, Fable’s integration with Webpack means there will only be one configuration file and better interaction with languages like JavaScript or TypeScript. While it might seem risky to tie Fable to Webpack, most users already have been using it, Garcia-Cano said.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author