发布于 2014-10-16 00:32:56 | 210 次阅读 | 评论: 0 | 来源: 网友投递
Kotlin 基于JVM的编程语言
Kotlin 是一个基于 JVM 的新的编程语言,由 JetBrains 开发。
Kotlin 是一个基于 JVM 的新的编程语言,由 JetBrains 开发。
其主要设计目标:
创建一种兼容Java的语言
让它比Java更安全,能够静态检测常见的陷阱。如:引用空指针
让 它比Java更简洁,通过支持variable type inference,higher-order functions (closures),extension functions,mixins and first-class delegation等实现。
让它比最成熟的竞争对手Scala语言更加简单。
Kotlin M9 发布,此版本包括重要的新特性和改进:
平台类型
更多平台互操作
不再有本地对象声明
非本地返回
Type 不再是关键字
Unit 现在是命名对象
Foo.instance$ 变成 Foo.INSTANCE$
增量构建
注意 此特性是尝试性的,如果遇到不能运行的地方,请运行 Rebuild Project。
支持编译器选项下的 making projects automatically
除了改进了标准库,同时还改进了语言支持,允许:
Delegation (class Foo : Bar by baz
)
Callable references for functions and properties (::foo
)
Support for Long
and improved support for Char
types
Inline functions support
Multiple catch
-blocks
重要改进:
Native traits exist only at compile time
Some changes in function name mangling
Moving and renaming some packages
js.* is now kotlin.js.*
js.query.* is now jquery.*
js.debug.* is now kotlin.js.*
Changes in println()
behavior:
on node.js – write to stdout
otherwise (in the browser) – buffered write to console.log, flush buffer to console on “n”
提取函数重构和代码重复
从 Usage 创建
模块改进
通过 Convention 查找和重命名
其他 IDE 改进
Debugger. Now supports delegated properties.
Completion. Overall improvements in completion in addition to completion for as when expected types are known at the point of invocation
Expand selection. Offering pretty much all the same functionality we currently have for Java
Java to Kotlin converter. Allowing for more conversion scenarios.
还有大量 bug 修复。
更多内容请看发行说明。