By Danny Preussler
While working on my KotlinConf presentation about types I stumbled upon this post by Maximiliano Felice about Phantom types with Scala. The idea: prevent objects from having an illegal state or forbid illegal operation at compile time. The example given was a class Door. A door is either open or closed. In Kotlin this would look like: