Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Kotlin 1.3 M1 arrives with coroutines, and new experimental features like unsigned integer types

Save for later
  • 3 min read
  • 01 Aug 2018

article-image

After Kotlin had released 1.2 nearly six months ago, the official language for Android finally announced the first release candidate of their next major version: ‘1.3 M1’. This new release comes with plenty of features most notably coroutines, new experimental unsigned arithmetic, and much more.

Coroutines are no longer a pipe dream


Coroutines have been in the experimental stage since they were first introduced in Kotlin 1.1. Kotlin 1.3 brings Coroutines to limelight as JetBrains’ Ilya Gorbunov explained in his blog post announcing Kotlin 1.3-M1. Coroutines simplify asynchronous programming by putting the complications into libraries.

With coroutines, developers can express the logic of the program sequentially and the library will take care of the asynchrony. What’s more interesting is that with Kotlin coroutines developers can call asynchronous mechanisms from different programming languages into their own program as libraries. For example  async/await from C# and ECMAScript, channels and select from Go, and generators/yield from C# and Python.

The Kotlin team has significantly improved the features surrounding coroutines since they were first introduced, some notable features include support callable references to suspending functions and serializability of all coroutine-related classes. But that’s not it, the Kotlin team plan to add a multiplatform version of the coroutine API which will support iOS through Kotlin/Native.

Experimental New Features


The technique of introducing experimental features in a release version helps the development team to gather valuable feedback from the community and implement their suggestions in the future releases, and that is exactly what the the Kotlin team has been doing.

We saw a similar implementation with Coroutines in the previous version, and now the team is introducing a plethora of new experimental features such as inline classes, unsigned integer types, and annotations for marking an experimental API and opting-in for it. In order to use these experimental features in projects, developers would have to explicitly choose an opt-in flag. Without an opt-in, usage of a feature will be marked as warnings or errors.

Other small features in Kotlin 1.3


While the bigger new features have been released as experimental there are numerous small features which have been released in this new version.

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €18.99/month. Cancel anytime

Capturing when subject in a variable


Capturing the subject of when expression in a variable is now supported in Kotlin language. This feature was one of the most popular feature request in Kotlin team’s issue tracker. This addition makes the response variable properly scoped within when expression, and makes the logic flow in a more expression-like fashion.

@JvmStatic and @JvmField in companions of interfaces


Kotlin interfaces can now expose static members (fields and methods) to Java clients. However, to use @JvmField on interface companion properties, all of them must be public final vals and all of them must be annotated. Also, the -jvm-target compiler option must be at least 1.8.

Nested declarations in annotation classes


Before 1.3, annotation classes could not have bodies in Kotlin. This release relaxes this limitation, allowing them to have nested classes, interfaces, and objects including a companion object.

These are just a select set of features that make up for the entire release announcement of Kotlin 1.3. If you are interested in checking out the entire feature-set including the new APIs that are available in the standard library and the breaking changes, you can refer to JetBrain’s official blog.

Kotlin/Native 0.8 recently released with safer concurrent programming

4 operator overloading techniques in Kotlin you need to know

Building RESTful web services with Kotlin