but this stone is reasonably soft, and with some effort we can reshape it later. Kotlin Design Team * The real sculpture made by José Manuel Castro López
Compiler error: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? We know something about isNullOrEmpty, which the compiler doesn’t if (s != null && s.isNotEmpty()) { s.first() } ✓
{ callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } Contract: block lambda will be always called once val answer: Int run { answer = 42 } ✓
null) } return this == null || this.length == 0 } Contract: if the function returns false, the receiver is not-null val s: String? = "" if (!s.isNullOrEmpty()) { s.first() } ✓
just implicitly infer such information? Because then such implicitly inferred information: - can be implicitly changed - can accidentally break code depending on it
newList = list.add(4) println(newList) // [1, 2, 3, 4] Modification operation returns new collection: Under the hood, newList shares parts of data structure with the original list
java.lang.Character.isUpperCase(this) Now: fun Char.isUpperCase(): Boolean = java.lang.Character.isUpperCase(this) Before: expect / actual in standard library
Kotlin Native to Port 6 years of Android Game Code to iOS in 6 months Shipping a Mobile Multiplatform Project on iOS & Android Your Multiplatform Kaptain has Arrived: iOS release is powered by Kotlin Multiplatform