Kotlin 1.2 Arrives with Some Interesting News

Kotlin has now reached version 1.2, a “major release” that adds some interesting new features and curious wrinkles.

After reaching its dot-zero (version 1.0) milestone, Kotlin was quickly adopted as an official Android language. The most recent Android Studio release supports it directly, and it has rocketed up various language trend lists.

Version 1.1 cobbled in a JavaScript target, which let you compile Kotlin versus JavaScript and run it in the browser. Version 1.2 lets you reuse code between the JavaScript Virtual Machine (JVM) and JavaScript (JS), which allows developers to “write the business logic of your application once, and reuse it across all tiers of your application – the backend, the browser frontend and the Android mobile app.”

The Kotlin team also reports it’s working on libraries for cross-platform serialization of code. For now, there’s a focus on multi-platform projects.

A multi-platform project allows you to build multiple tiers of your application (backend, frontend and Android app) from the same codebase. Such projects contain common modules, which feature platform-independent code, as well as platform-specific modules, which contain code for a specific platform (JVM or JS) and can use platform-specific libraries. To call platform-specific code from a common module, you can specify expected declarations, which all platform-specific modules need to provide actual implementations.

The aforementioned libraries come in the form of .test, .html and .serialization. Test allows you to write once and run your code under JVM and JS. HTML supports isomorphic rendering, which uses the same code to render HTML content on the back and front ends. Serialization uses JSON or ProtoBuf to “marshal Kotlin objects between different tiers of your application.”

Boilerplate functionality has also improved. Kotlin 1.2 compiles 25 percent faster than version 1.1, and uses a more concise syntax for passing multiple arguments to array literals. Kotlin even has a new .math library because – well, math.

Parsing the news a bit, we have to wonder if Kotlin is coming for iOS. Google has cloned Swift to serve as a “staging ground” for pull requests and the like, with Swift founder (and current Googler) Chris Lattner saying there are lots of people working on the language in Mountain View. Between that and the Kotlin team’s cagey language surrounding platform and language interoperability, Kotlin could be poising to become the next React Native.

Post a Comment

Your email address will not be published.