Babel Adds Ability To Parse F# Like Pipelines
Written by Ian Elliot   
Monday, 15 July 2019

The latest version of JavaScript compiler Babel 7.5 has been released with the ability to parse and transpile F# and similar pipelines. Support has also been added for dynamic imports, as well as experimental support for TypeScript namespaces.

As its former name 6to5 suggests, Babel takes JavaScript ECMAScript 2015+ code and converts it into a backwards compatible version to run in older browsers. It can also convert React JSX syntax into JavaScript.

This means developers can use all the new features of JavaScript and know it will still work in older browsers, but the need has become less as fewer people use older browsers that don't have support for ES2015 and beyond. It also becomes less important because the improvements currently being proposed for JavaScript are fairly minor if desirable and most can wait until they are widely supported rather than need to rush in to use them.

babel

The new release of Babel incorporates another version of the pipeline operator. The process of adding the pipeline operator to JavaScript is still at the earliest stage 1, and at the moment there are five variants. The first 'minimal' variant has been supported in Babel since version 7.0.0, while another variant (the 'smart' variant) came into Babel at version 7.3. This new release adds support for the second variant, the so-called F# variant, because it works in the same way as the F# pipeline operator. The Babel developers say the F# variant differs from the Smart variant by using arrow functions rather than topic references. This has the advantage of being more similar to current JavaScript, at the cost of a slightly less concise syntax. It's a backwards-compatible way of streamlining chained function calls in a functional manner, and provides a practical alternative to extending object prototypes for methods.

All the pipeline operators make code more readable when chaining several functions together.

The other main improvement to the new version is unified support for parsing dynamic imports.In earlier versions of Babel, you needed to use different Babel plugins depending on which bundler you were planning to use. This new release handles Webpack, Rollup, Node and SystemJS bundlers using a single plugin.

The final improvement is the addition of experimental support for TypeScript namespaces. The developers say that namespaces were the second biggest TypeScript feature not supported by Babel (the first one is type-checking). This current (experimental) support does have some limitations. In particular, namespaces can only export immutable bindings, and when you're merging multiple namespaces with the same name, their scope isn't shared.  

 

babel

 

More Information

Babel On GitHub

Related Articles

Babel Adds Smart Pipelines 

Babel 7 Released With Improved TypeScript Support

Babel 6 More Than A JavaScript Modernizer

6to5 Renamed As Babel - Are You Ready For The Next Gen JavaScript?       

JavaScript 6 EcmaScript 2015 Final Approval         

 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


SnapCode: A Java IDE for the Web
27/02/2024

Thanks to CheerpJ and WebAssembly you can now run a Java IDE inside your browser and local first.This is SnapCode, and while lightweight and in-browser, is to be not underestimated.



Opaque Systems Introduces Gateway GenAI Solution
14/03/2024

Opaque Systems has announced an early access program for Opaque Gateway, software designed to address data privacy, security, and sovereignty concerns in managing GenAI implementations.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

 

<ASIN:1871962579>

<ASIN:1871962560>

Last Updated ( Tuesday, 16 July 2019 )