Kotlin 1.1 beta adds JavaScript compilation

Published January 23, 2017 by lagmen
Kotlin 1.1 beta adds JavaScript compilation

The new version of the language also incorporates experimental support for co-routines on the JVM, Android, and JavaScript

Kotlin, JetBrains’ statically typed language, is bolstering its JavaScript and Java standing with the 1.1 beta release this week, adding JavaScript compilation and co-routines on both the JVM and JavaScript.

JavaScript compilation had been in an incomplete, experimental phase, even as builders have had JavaScript ambitions for Kotlin for several years. “There were many things missing from the standard library and things such as proper interop with package systems weren’t production-ready,” said Hadi Hariri, vice president of developer advocacy at JetBrains. “With 1.1, there was a focus to make all of this happen.”

The language now has proper support for different types of modules in JavaScript as well as having the standard library in part with the JVM. The compilation capability means developers can use Kotlin strings, collections, sequences, arrays, and other core APIs on JavaScript, as well as JVM/Android, said Antony Breslav, lead language designer for Kotlin at JetBrains. “Numerous popular JS libraries will be available through typed headers (converted from DefinitelyTyped),” Breslav said.

JetBrains is supporting popular runtime module systems for JavaScript, along with webpack and other important tools. With Kotlin 1.2 and beyond, JetBrains plans to improve JavaScript tooling. “Our goal is to enable pleasant full-stack development with Kotlin,” Breslav said.

The beta also has experimental support of co-routines (functions that can be suspended and resumed) on the JVM, Android, and JavaScript. This means developers can use future/await, yield, and similar programming patterns. With Kotlin’s design, the implementation of co-routines is part of the libraries rather than the language, meaning developers are not bound to a specific programming paradigm or concurrency library.

Type aliases in version 1.1 enable developers to define an alternative name for a type. This is useful for generic types, such as collections, and for function types. Bound callable references in the beta, meanwhile, allow use of the : : operator to access a member reference that points to a method or property of a specific object instance. This previously was reserved for lambdas.

Compiler plugins are featured to make classes open by default, generation of no-arg constructors, also by default, and extending SAM (single abstract method) conversions. Also, some restrictions on sealed and data classes were removed; developers now can define subclasses of a sealed subclass in the same file and not only as nested classes of the sealed class. Data classes can extend other classes and be used to define a hierarchy of expressions “nicely and cleanly,” JetBrains said. Verson 1.1 deprecates the name mod that was used for the % operator and replaces it with the name ram, which is semantically correct and agrees with libraries like java.math.BigInteger.

Kotlin joined the fray on the JVM early in the decade. Recently, it has taken hold on the Tiobe language popularity index, reaching the top 100 on that list. It was ranked 87th this month. Kotlin 1.1 is expected to reach a general-release stage this quarter.

Source: Infoworld.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: