Kotlin 1.2 发布,实现平台间共享代码

栏目: 软件资讯 · 发布时间: 7年前

内容简介:Kotlin 1.2 发布了。多平台项目允许您从相同的代码库构建应用程序的多个层 - 后端,前端和 Android 应用程序。 这样的项目包含了独立于平台的代码的通用模块,以及特定平台(JVM 或 JS)的代码的特定模块,并且可...

Kotlin 1.2 发布,实现平台间共享代码

Kotlin 1.2 发布了。多平台项目允许您从相同的代码库构建应用程序的多个层 - 后端,前端和 Android 应用程序。 这样的项目包含了独立于平台的代码的通用模块,以及特定平台(JVM 或 JS)的代码的特定模块,并且可以使用平台特定的库。 要从通用模块中调用特定于平台的代码,您可以指定预期的声明 - 所有平台特定模块需要提供实际实现的声明。

Kotlin 1.2 发布,实现平台间共享代码

如前所述,开发团队也在研究一系列通用库,以便将更多的逻辑转移到通用代码中:

  • kotlin.test, 在Kotlin 1.2开箱即用,只要编写一次测试就能在 JVM 和 JS 下运行;

  • kotlinx.html 支持同构渲染 - 使用相同的代码在后端和前端渲染 HTML;

  • kotlinx.serialization 允许您使用 JSON 或 ProtoBuf 作为序列化格式,轻松地将 Kotlin 对象封装在应用程序的不同层之间。

编译性能提升 25%,下图显示了使用 Kotlin 构建的两个大型 JetBrains 项目的编译时间差异:

Kotlin 1.2 发布,实现平台间共享代码

其他改进:

  • A more concise syntax for passing multiple arguments to an annotation (array literals);

  • Support for the lateinit modifier on top-level properties and local variables, as well as checking whether a lateinit variable is initialized;

  • Smarter smart casts and improved type inference in certain cases;

  • Compatibility of the standard library with the split package restrictions introduced in Java 9;

  • New kotlin.math package in the standard library;

  • New standard library functions for working with sequences and collections, including a set of functions for breaking a collection or sequence into potentially overlapping groups of a fixed size.

下载地址:


【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The  C Programming Language

The C Programming Language

Brian W. Kernighan、Dennis M. Ritchie / Prentice Hall / 1988-4-1 / USD 67.00

Presents a complete guide to ANSI standard C language programming. Written by the developers of C, this new version helps readers keep up with the finalized ANSI standard for C while showing how to ta......一起来看看 《The C Programming Language》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具