October 3rd, 2017

What’s new in Kotlin 1.2? Code reuse, for starters

Core Java, Java Android Developer, Java App Dev, others, Programing, Scripting and JVM Languages, by admin.

Version 1.2 of the statically typed Kotlin language, will offer an experimental feature enabling reuse of code across platforms, as well as compatibility with the Java 9 module system. The beta of Kotlin 1.2 is now available for download.

Kotlin’s experimental multiplatform projects capability lets developers reuse code between supported target platforms: JVM and JavaScript initially, and later native. Code to be shared between platforms is placed in a common module; platform-dependent parts are put in platform-specific modules. During compilation, code is produced for both the common and platform-specific parts.

Developers can express dependencies of common code on platform-specific parts via expected and actual declarations. This declaration specifies an API, while an actual declaration is either platform-specific to the API or a type alias that refers to an existing implementation of the API in an external library. The standard library, meanwhile, features the kotlin.math package for performing mathematical operations in cross-platform code.

The kotlin.math package also now offers better precision for math polyfills for JavaScript.

Back Top

Leave a Reply