Kotlin 1.3 is out: Coroutines graduate to stable, plus betas for Kotlin/Native & Ktor 1.0
We’ve been talking about coroutines for the past three months and now they are finally here (and stable!). But that’s not all Kotlin 1.3 has to offer; it arrives with a bunch of libraries, build tools, and learning materials in tow. Let’s have a closer look at what’s included in this release.
Kotlin 1.3 is here. This release includes a lot of goodies but if we were to summarize it, we would include the following milestones:
- Coroutines are now stable
- Kotlin/Native has reached Beta
- Multiplatform projects are moving forward (still an experimental feature though!)
- Ktor 1.0 has reached Beta
You can give Kotlin a try online at play.kotl.in.
- In Maven, Gradle and npm: Use
1.3.0as the version number for the compiler and the standard library. See the docs here.
- In IntelliJ IDEA: 2018.3 has Kotlin 1.3 bundled, in earlier versions Install or update the Kotlin plugin to version 1.3.
- In Android Studio: Install or update the plugin through Plugin Manager.
- In Eclipse: install the plugin using Marketplace.
- The command-line compiler can be downloaded from the Github release page.
Kotlin 1.3 highlights
This tool will come in handy if you want to offload work onto background workers or implement complicated network protocols. The kotlinx.coroutines library hits 1.0 release and provides a solid foundation for managing asynchronous jobs at any scale including composition, cancelation, exception handling and UI-specific use cases, as explained in the blog post detailing the highlights.
If you’re not entirely sure what coroutines are and how you can use them, check out the brand new coroutines overview page.
Kotlin/Native reaches beta
If you wish to compile Kotlin code to native binaries, you’ll need Kotlin/Native. This technology uses LLVM to compile Kotlin sources to standalone binaries (no VM required!) for a bunch of operating systems and CPU architectures including iOS, Linux, Windows, Mac and even WebAssembly and embedded systems like STM32.
In short, “it solves the situations when a developer needs to produce a self-contained program that does not require an additional runtime or virtual machine.” For more details about its advantages, check out the Kotlin/Native overview.
Multiplatform projects and tooling
The Kotlin team has completely reworked the model of multiplatform projects with the purpose of improving expressiveness and flexibility, and making sharing common code easier. Since we just mentioned Kotlin/Native, you should know that it’s also supported as one of the targets. Read more about multiplatform programming here.
Kotlin 1.3 arrives with tooling support for Kotlin/Native and Multiplatform projects in tow, which is now available in IntelliJ IDEA Community Edition, IntelliJ IDEA Ultimate, and Android Studio. It’s worth mentioning that all code editing features such as error highlighting, code completion, navigation and refactoring are available in all the three IDEs.
Ktor 1.0 beta
Ktor, JetBrains’ connected applications framework which implements the entire HTTP stack fully asynchronously using coroutines, has reached Beta and is available at ktor.io.
Other features and improvements
- Experimental support for inline classes for performance and type safety
- Experimental support for unsigned integers to facilitate byte-manipulation and other low-level code
- Subject in
whenexpressions to reduce boilerplate
- Contracts to improve static analysis for library calls
- No-arg entry point for cleaner beginners’ experience
- Sequence debugger for visualizing lazy computations
- Scratch files, REPL and scripting improvements for smoothly working with scripts and code snippets
- Standard Library expanded to Kotlin/Native, improved support for Kotlin/JS, got Random on all platforms and has other improvements and bug fixes.
- Experimental incremental compilation for Kotlin/JS