Beauty of Kotlin Type System

By Kirill Rozov

Elevator Pitch

Kotlin is a very good language that gave us the Null Safety. Especially after Java. Nullable Types is the base concept of the Kotlin’s type system. But this isn’t the end and a lot of really good features with types you can do in Kotlin. Let’s find out what!

Description

The main idea of the talk it’s summarize everything about types and usage of the in Kotlin and make an architecture of an app better.

Topics of the talk:

  • Nullability as the base concept of the language
  • Special type: Any, Unit, Nothing
  • Collection separation
    • Mutable & Immutable
    • Can you fell safety with Kotlin’s immutable collection?
    • Real immutable collections
  • Enum + steroids = Sealed classes
    • Why enum isn’t enough?
    • What’s sealed class
    • Features of sealed classes and when
    • Best tasks for sealed classes
  • Inline classes
    • How is working
    • Safety work with data in Strings & Int when the meaning of values are different
    • When no inline for inline classes is happening
  • Unsigned numbers
  • Typealias
    • What is type alias?
    • Where it can be applied?
    • Role in Kotlin MPP projects
    • The difference with named import
  • Generic
    • in, out and how to understand is
    • More possibilities with restrictions using where
    • Generic Java backward compatibility
  • Type inference

Notes

My previous talks (all in Russian) - https://www.youtube.com/playlist?list=PL4Z3p7Clf-jJr_A1XqAEHm7gtKhmIg35_