Kotlin/Native v0.2 is out

We’re happy to announce the release of Kotlin/Native v0.2, a feature and bugfix update to Kotlin/Native Technology Preview. This update adds support for coroutines and cross-module inline functions support, along with bugfixes and improvements all over the place.

This release includes samples showing how to use coroutines for concurrent non-blocking IO, a GUI application using GTK, as well as a TensorFlow machine learning framework client contributed by Julius Kunze.

For example, code as easy as

can be used to process multiple concurrent socket IO with coroutines and serve each client individually and concurrently.

And to create a GTK button with an event listener, just do:

So v0.2 release allows  to create fully functional small-footprint native applications written in Kotlin.

Both compilation and runtime performance were significantly improved, size of redistributable decreased.

The complete list of changes in this release can be found in the changelog.

Pre-built binaries for Linux and MacOS hosts are available.

About Nikolay Igotti

Kotlin/Native Tech Lead
This entry was posted in Releases and tagged , . Bookmark the permalink.

16 Responses to Kotlin/Native v0.2 is out

  1. Pavel says:

    Congrats!
    Could you provide a tutorial to build simple kotlin-native app with IntelliJ Idea?

  2. Pingback: Kotlin/Native v0.2 is out (Official announcement from Jetbrains) | Ace Infoway

  3. Nikolay Igotti says:

    IDE support for Kotlin/Native is in progress, you may try to use Gradle support in IDEA along with Kotlin/Native Gradle plugin (see https://github.com/JetBrains/kotlin-native/blob/master/GRADLE_PLUGIN.md)

  4. Pingback: Kotlin/Native v0.2 发布,将 Kotlin 编译成机器码 | News Pod

  5. Clóvis Valadares says:

    When a windows version?

  6. Al says:

    Does the existence of Kotlin Native mean there will be proper tail call elimination even without the JVM supporting it? I’ve always felt that lacking this is annoying considering it’s entirely technically possible even on the JVM if resources were invested to make it a reality (it’s just not important to Oracle’s customers for Java). Even Microsoft’s F# supports these optimizations despite running on the CLR.

    • Nikolay Igotti says:

      For tail recursion case there’s ‘tailrec’ keyword, which is being supported in Native as well. For other cases, tail call elimination could be done by LLVM backend for some cases.

  7. Guys where are Kotlin feature requests tracked? Can’t find anywhere to post this.

    Anyways our feedback from maintaining a full dual-platform Swift/Kotlin codebase (same engineer implements features natively in both platforms) is that there are still several features that Kotlin as a language still lacks in order to be on par with Swift and thus iOS.

    One in particular that comes up constantly is the lack of lateinit in delegated properties.
    ie: There is essentially no way to convert the following Swift code in Kotlin:

    The closest Kotlin equivalent forces the variable to be optional, which loses the semantic and is against the whole Kotlin/Swift optionals movement (ie: forces you to use a nullable field for something that is semantically non-null):

    Of course the real solution is to allow ‘lateinit’ to be used in conjunction with delegated properties:

    • Nikolay Igotti says:

      Please use Kotlin issue tracker here: https://youtrack.jetbrains.com/issues/KT

    • Alexander Udalov says:

      Wouldn’t declaring a custom delegate help here?

      • Thanks for that example Alexander.

        I bring this up in particular because if you are to support iOS native, this is an extremely common scenario in literally every Swift codebase I have seen – and has no current out-of-box Kotlin equivalent.

        I don’t think requiring teams to make their own custom delegated properties is the way. This needs to be standardized and provided either at the language level or in the base Kotlin libraries (ie: delegates.observable).

        I’ve filed an issue for it here: https://youtrack.jetbrains.com/issue/KT-17979

        Congrats again to the huge Android/Google news guys.

  8. Roman says:

    Have you done any benchmarking of Kotlin Native vs Kotlin JVM ? Which one is expected to have better performance?

    • Nikolay Igotti says:

      Performance is multidimensional notion, so it really depends on what is measured. Startup performance, memory management pauses and pure computations are likely better with Kotlin/Native, while massive object manipulations shall be better with Kotlin/JVM. Also note that current Kotlin/Native runtime wasn’t optimized, unlike modern JVMs, where thousands engineer/years spent on optimizations.

      • Roman says:

        I see, so it depends on particular application. Is it possible to use two runtimes simulatneousy and how interop will look like? Can I for example call K/N funciton from K/JVM and pass reference to JVM managed object as a parameter?

        • Nikolay Igotti says:

          Kotlin/JVM -> Kotlin/Native interop is not currently supported, beyond generic Kotlin/JVM -> C interop. Arbitrary object interoperability is unlikely to be supported soon.

Leave a Reply

Your email address will not be published. Required fields are marked *