Alejandro Serrano Mena

Alejandro Serrano Mena

Researcher, Kotlin Language Evolution Team at JetBrains

What makes Kotlin smart

Understanding smart casting and smart contracts in Kotlin

Alejandro Serrano Mena is a passionate advocate of programming language design, formal methods and functional programming in software development. He works as researcher in the Kotlin Language Evolution team at JetBrains and helps co-maintain the Arrow library. He enjoys not only using and improving those tools, but also spreading the word: he’s written four books targeting different levels, regularly gives talks in conferences and meetups.

For quite some time Alejandro was an academic, working on the area of compilers and type systems for functional languages. His PhD thesis versed over error messages, and he’s been involved in efforts like improving GHC’s support for impredicativity. This knowledge is put in practice in several open source projects, many of them using metaprogramming techniques or compiler extensions.

Talk Abstract

In this talk we shall look at two features in Kotlin which set them apart from other JVM languages: smart casting, and smart contracts. With those, the compiler is able to aggregate information about your code as the function progresses, usually leading to fewer needs for casting or matching. The goal of this talk is to understand the conceptual model behind smart casting.

Talk Outline

  • Quick summary of smart casting
  • Smart casting and nullability
  • Conditional casting and contracts
  • When smart casting is impossible
  • Future improvements: exhaustiveness and subtyping reconstruction