3. Kotlinとは
2016/02/21 How cute Kotlin is.
To create a Java-compatible language, That compiles at least as fast as Java,
Make it safer than Java, i.e. statically check for common pitfalls such as null pointer dereference,
Make it more concise than Java by supporting variable type inference, higher-order functions (closures), extension functions, mixins
and first-class delegation, etc;
And, keeping the useful level of expressiveness (see above), make it way simpler than the most mature competitor – Scala.
By FAQ – Kotlin Programming Language(https://kotlinlang.org/docs/reference/faq.html)
6. Delegationあれこれ
クラスに対して
class A(var h:IHoge):IHoge by h { }
これだけでAはIHogeのメソッドやプロパティを実装しているように見せられる
コードの依存の分離や単体テストに有利
プロパティに対して
クラス内で val v:String by lazy { “Lazy...” }
プロパティについての、決まりきった処理を簡単に実装できる
遅延初期化(lazy)や変化の通知(observable)を用意 自作も可能
2016/02/21 How cute Kotlin is.
by