kotlin

kotlin hello world anyway.

更新日:

XCodeが10になって色々言われていてビビってあまり本質的でないところに引っかかりそうだったのと、
そもそもXCode10が全然落ちてこないので、先にkotlin@IntelliJ IDEA@Macを試した。
しばらくkotlinの言語仕様の勉強をしてみることにする(Androidアプリにしないで)。

kotlin overview

JVM上で実行される静的型付けのオブジェクト志向言語。
本家の解説を1行ずつ噛み締めながら読んでいく。
引用文に意訳を付けていくセルフ輪講形式。

Kotlin is a great fit for developing Android applications, bringing all of the advantages of a modern language to the Android platform without introducing any new restrictions:
kotlinはAndroidアプリケーション開発に適した言語であって、モダンな言語が持つ利点を導入によって新しい制約を持ち出すことなしにAndroidプラットフォームにもたらす。

  • Compatibility: Kotlin is fully compatible with JDK 6, ensuring that Kotlin applications can run on older Android devices with no issues. The Kotlin tooling is fully supported in Android Studio and compatible with the Android build system.
    互換性。kotlinはJDK6と完全な互換性がある。kotlinアプリケーションが古いAndroidデバイスで動作することを保証する。
  • Performance: A Kotlin application runs as fast as an equivalent Java one, thanks to very similar bytecode structure. With Kotlin’s support for inline functions, code using lambdas often runs even faster than the same code written in Java.
    パフォーマンス。kotlinアプリケーションはJavaアプリケーションと非常に似たバイトコード構造となることで、Javaアプリケーションと同等の速度で動作する。
  • Interoperability: Kotlin is 100% interoperable with Java, allowing to use all existing Android libraries in a Kotlin application. This includes annotation processing, so databinding and Dagger work too.
    相互互換性。kotlinはJavaと100%相互互換性がある。従って、全ての既存のAndroidライブラリはkotlinアプリケーションで動作する。この振る舞いには追加処理が含まれ、データバインディングやデバッガもまた動作する。
  • Footprint: Kotlin has a very compact runtime library, which can be further reduced through the use of ProGuard. In a real application, the Kotlin runtime adds only a few hundred methods and less than 100K to the size of the .apk file.
    フットプリント。kotlinは非常に小さな実行時ライブラリである。ProGuard使用時によりも小さくなる。また、kotlinランタイムは、たかだか2,300の新しいメソッドが加わるだけであり、.apkのサイズは100KB未満となる。
  • Compilation Time: Kotlin supports efficient incremental compilation, so while there’s some additional overhead for clean builds, incremental builds are usually as fast or faster than with Java.
    コンパイル時間。kotlinは効率的なインクリメンタルコンパイルをサポートしている。従って、(ベースとなる)Javaのクリーンビルドと比較してオーバーヘッドがあるにも関わらず、インクリメンタルコンパイラによるコンパイル時間はJavaのそれと比べて同じかより速い。
  • Learning Curve: For a Java developer, getting started with Kotlin is very easy. The automated Java to Kotlin converter included in the Kotlin plugin helps with the first steps. Kotlin Koans offer a guide through the key features of the language with a series of interactive exercises.
    学習曲線。Java開発者にとって、kotlinを始めるのは非常に簡単である。まずは、kotlinプラグインに含まれるJava->kotlin自動コンバータの恩恵を受ける。

anyway

参考にしたのは以下。
正味1時間くらいで環境構築できた。
Kotlin入門 IntelliJ IDEAで開発環境の構築とHello World
他にはAndroid Studioがないといけないんだろう…。

kotlinの文法をチェックするだけなら、
kotlin playgroundで出来る。

とりあえずhello,world.出してみる。
Scalaみたく.classが出力される。
コンパイル速度は遅くはないけど瞬殺って訳でもない。
2013LateのMBPでhello worldが2秒くらい。

10月29日にkotlin1.3がリリースされてる。
.classを経由しないでいきなりNativeになるとか。
今のところ聞かなかったことに…。

kotlinの名前の由来はコトリン島
サンクトペテルブルグに近いバルト海に浮かぶ島だそう。
JetBrains社のサンクトペテルブルグにある研究所が作った言語なんだそうで。

とりあえず、とりあえず、でわからないままAndroidアプリにしても、
何も意味がないので、kotlinの言語仕様から。

結構続く。

-kotlin
-

Copyright© ikuty.com , 2024 AllRights Reserved Powered by AFFINGER4.