Jarno Walgemoed short introduction on some new interesting features in Kotlin 1.3. Kotlin’s built-in null-safety makes it easy for us to write code that’s less error-prone and less susceptible to the unwanted and unexpected NullpointerException at runtime.
Kotlin is introducing Contracts in the upcoming 1.3 release in which we can use contracts to tell the compiler how a function behaves and what results are implied, so we can benefit from improved smart-casts.
Starting with Kotlin 1.3, we can start defining contracts for our functions.
Supplying the compiler with contracts for applicable functions can help clean up code on the call site and remove redundant null-checks.
You will find example code describing a User and implementation defining the contracts using Returns and Implies. Excellent intro into contracts in Kotlin!
[Read More]