Kotlin/Native v0.8 released

We’re happy to announce the release of Kotlin/Native v0.8! The focus of this release is on:

  • safer concurrent programming
  • extending the stdlib functionality
  • better iOS development support.

Also, numerous bug-fixes and optimizations were implemented in this release.

AppCode and CLion Kotlin/Native plugins were updated to work with v0.8, along with minor performance and usability improvements.

Binaries can be downloaded from the following links: macOS, Linux, Windows

A Linux Snap package is also available.

GitHub release page is here.

Better concurrency support.

Before v0.8, Kotlin/Native applications were keeping the singleton object state local to a particular thread of execution, so the state of singleton objects on different threads could be non-synchronized. Now, extending the notion of freezing on singleton objects, we allow a shared immutable state.

For example, following code

will read the configuration file and can provide a Config.width property later on.  The Config file will be read once per process execution, and is available to any thread or worker. Once published, the object is frozen, and cannot be modified anymore (modification attempts will throw an InvalidMutabilityException).

Another feature intended for better concurrency support in Kotlin/Native is the atomic values and references. For example, to extend the above sample of a program-wide configuration by adding a potentially updateable program icon, we could do

Note, that operation is atomic, and icon data stored in an AtomicReference itself is frozen. This way we can ensure that the data updates are atomic, and all the other clients see a consistent state.

Library improvements.

With the release 0.8 standard library (kotlin.*) in Kotlin/Native is finally standardized with other platforms using expect/actual mechanism, and mostly (modulo reflection and some synchronization-related operations) matches other Kotlin flavors. Also, the standard random number generator and collection shuffling functions are now available, so there is no need to use platform-specific APIs to obtain random numbers anymore.

Other important JetBrains-provided libraries, like kotlinx.coroutines, kotlinx.serialization, and Ktor HTTP client are getting experimental Kotlin/Native support, which means it is possible to write an iOS app and Android application sharing the same REST API-related logic.

iOS support improvements.

We are working hard on making Kotlin/Native a viable iOS development technology, so in this release, we fixed few annoying problems preventing publishing to AppStore, a framework initialization problem and supported 32-bit ARM iOS, so that older devices can be used with Kotlin/Native as well.

Let’s Kotlin

About Nikolay Igotti

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

10 Responses to Kotlin/Native v0.8 released

  1. Nick Apperley says:

    What is missing from the Kotlin Native libraries is a “Embedded Web Server” library, which can be included in a Kotlin Native server-side app that provides the following:

    Starts up quickly and has a low resource footprint (very important for Serverless and backend software testing)
    Has a low maintenance cost (memory is managed via ARC with cyclic collector and “Kotlinic” APIs are provided)
    Supports HTTP/HTTPS, serving static assets (images, text, JS etc), and Web Sockets
    Concurrency is done via Kotlin Coroutines
    The Web Server can be deployed to amd64 (eg Linux), ARMv7 (eg Raspberry Pi), and ARMv8 platforms

  2. Nikolay Igotti says:

    Well, ktor(https://github.com/ktorio) has builtin webserver and library team is working on adding Native Support there. Another option would be writing lightweight wrapper on top of microhttpd, like in https://github.com/JetBrains/kotlinconf-spinner/blob/master/kotlin-native/samples/fullstack/httpserver/src/main/kotlin/server/HttpServer.kt.

    • Benny says:

      As far as i can see Ktor currently is hardly a match for PHP ( https://www.techempower.com/benchmarks/ ), let alone other implementations.

      The problem with 3th party web servers tends to be that the support is not guaranteed unlike the language itself.

      With Go, you are sure that the build in HTTP server will run perfectly every time.
      When looking at D and its external 3th party web server Vibe.D, that tends to be hit or miss more often.

      • Nikolay Igotti says:

        Those are perf characteristics of of Ktor/JVM, Ktor/Native may behave differently.

      • Nick Apperley says:

        Take another look at the benchmarks. Ktor performs better is some areas (DB access with Single and Multiple queries, Plaintext) than PHP, while there are other areas where PHP is faster (JSON serialization, Fortunes, Data updates).

  3. Pingback: Kotlin/Native v0.8 发布,提供更安全的并发编程支持 – 技术成就梦想

  4. ALB says:

    Have you released a CLion plugin for Kotlin Native 0.8 for Windows? If not, when do you expect to do so?

  5. Bernd says:

    Are there any plans to support Kotlin/Native (and Kotlin JS) in Eclipse? It would be great to have a fully supported multiplatform project in one IDE.

Leave a Reply

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