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. 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.
More InformationRelated ArticlesBabel 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.
Comments
or email your comment to: comments@i-programmer.info
<ASIN:1871962579> <ASIN:1871962560> |
Last Updated ( Tuesday, 16 July 2019 ) |