Kotlin 1.4-M1 updates the standard library and adds new Kotlin/JS backend

Share
  • March 24, 2020

The JVM programming language Kotlin has been released in version 1.4-M1 as the first preview for the upcoming major version 1.4. The details were announced on the Kotlin Blog.

SEE ALSO: Top Java technologies in 2020 – JVM programming languages, IDEs, tools & more

Kotlin 1.4 is set to arrive this spring. With a focus on quality and performance, it should add only small language changes. Let’s dive right into the preview and see what awaits us.

New features

Kotlin 1.4-M1 sets the new type inference algorithm that was introduced in v1.3 as default. Previously, it had to be activated by specifying a compiler option. And that’s not all: several issues have been fixed and can be followed on YouTrack.

Kotlin/JS has received a new backend. The new IR compiler backend should enable optimizations and new features. Though not yet enabled by default, the Kotlin team encourages developers to start using it. This is how to enable it in the gradle.properties file:

kotlin.js.compiler=ir

And that’s not all that has changed for Kotlin/JS: In the kotlin.js and multiplatform Gradle plugins, the new setting produceExecutable() is now available. It can be used inside the target block in the build.gradle.kts file and is needed to generate .js artifacts during the build as shown here:

kotlin {
    target {
        useCommonJs()

        produceExecutable()
        
        browser {}
    }
}

Further updates in Kotlin 1.4-M1 include some updates to the standard library. For example, the deprecated mod operator has been removed, and conversions from floating types to Byte and Short have been deprecated.

As the blog post points out, backwards compatibility with Kotlin 1.3 is not given “in some corner cases.” A “compatibility guide” will be released to list such cases.

SEE ALSO: Introducing new JVM language Concurnas

Find out more about Kotlin 1.4-M1 in the blog post and the changelog.

The post Kotlin 1.4-M1 updates the standard library and adds new Kotlin/JS backend appeared first on JAXenter.

Source : JAXenter