Sneak peek of what's to come

Kotlin 1.1 has reached beta

Gabriela Motroc

Kotlin 1.1 has reached beta. Let’s see what’s coming (fairly soon!) in 1.1.

Kotlin 1.1 is not ready yet but it’s coming “fairly soon.” How do we know that? Kotlin 1.1 has finally reached beta.

According to the official announcement, the biggest highlights of 1.1 are the following: coroutines on the JVM, JavaScript and Android, as well as full support of compilation to JavaScript.

But that’s not all: other features and language improvements are coming such as:

Coroutines

Coroutines are about async/await, generate/yield, non-blocking IO, Rx and much more brought under the single unified paradigm of a suspending function. Such a function (or lambda) represents a computation that can be suspended (without blocking any threads) and resumed later, Andrey Breslav, Project Manager of Kotlin, wrote in the blog post announcing Kotlin 1.1 Beta.

future {
    val original = asyncLoadImage("...original...") // creates a Future
    val overlay = asyncLoadImage("...overlay...") // creates a Future
    ...
    // suspend while awaiting the loading of the images
    // then run `applyOverlay(...)` when they are both loaded
    return applyOverlay(original.await(), overlay.await())
}

According to Breslav, flexibility is the main benefit of coroutines. The language part is minimal, everything can be written as a library and libraries are in total control of all aspects of suspending and resuming computations: threads, exceptions and other aspects of computation are entirely customizable.

Kotlin coroutines will be released under an “experimental” opt-in flag, which means that the Kotlin team “is not committing to supporting the backwards compatibility of this feature after the final 1.1 release.”

Read more about coroutines here.

SEE ALSO: A first look at Kotlin 1.1

JavaScript

The full Kotlin language can be now compiled to JavaScript, Breslav announced in the blog post. However, this does not mean that they have ported all of the JDK into the browser; although the language and its Standard Library are not coupled with JDK, Kotlin strings, collections, sequences, arrays and other core APIs can be used on JS as well as JVM/Android.

The team will dedicate a lot of effort in Kotlin 1.2 and beyond to making the JavaScript tooling smooth and helpful, Breslav added.

Standard Library, tooling and frameworks

Kotlin’s Standard Library will include a variety of utilities and extensions including those specific for JDK 7 and 8. The collaboration with Gradle has resulted in gradle-script-kotlin, therefore users can now write type-safe build scripts for Gradle, using Kotlin scripting.

JSR 223 is now supported, which is utilized by the Spring Framework along with type-safe DSLs and other things.

You can find the entire list of new features here.

Author
Gabriela Motroc
Gabriela Motroc is an online editor for JAXenter.com. Before working at S&S Media she studied International Communication Management at The Hague University of Applied Sciences.

Comments
comments powered by Disqus