History of kotlin language


Hello, could you tell the history of kotlin language?
What are the languages it was based on, what features from what languages it borrowed?


something like what Bjarne Stroustrup wrote about C++(“Design and Evolution of C++”)


+1 : )


From what they have said they initially tried scala when looking for a better jvm language but rejected it because it was too complicated. They also rejected groovy due to its dynamic typing. One can also see C# influences in there as well. There are probably others but those are probably the big three that I see.


Jetbrains was looking for a replacement for Java to use in their products. They were seeing the limitations of Java, and little perspective of it being improved soon. Jetbrains has a big existing Java code base so rewriting everything was a no-go, so a new language needed to be Java compatible. They had a look at several JVM languages. One of their requirements was static compilation so in the end Scala was the only viable option of existing languages. They tried that, but ran into limitations of Scala such as slow compile speed (and little perspective of that being improved), and good IDE support not being possible due to the structure of the language. (Another reason you see companies move away from Scala is its complexity and Scala inviting you to write unreadable code, but I don’t know how much of a role that played for Jetbrains.)

In the end they decided to create their own Java compatible language, focused on practicality, with features that had already been proven in different languages, and superb IDE support. Many of Kotlins features are taken from other JVM languages, especially from Groovy. One of the more difficult features was the nullability in the type system. In general any feature that interacts with Java interop and does not have a direct analogy in Java will be hard to implement in a satisfying way. For nullability, the question was what type to assign to Java methods that were used from Kotlin. At first the Kotlin designers went with assuming nullability for Java parameters and return value, but that gave too much hassle. They tried to improve that by supporting manual nullability annotations on Java APIs, and automatic inference by analyzing the bytecode, but this did not give results that were good enough. Maintaining external nullability annotations for Java APIs was too hard and time consuming, and automatic nullability inference was not accurate enough to work smoothly. In the end they came up with platform types, which is what Kotlin uses today. A similar mechanism is used for mutable/immutable collections and Java APIs.

Source: I also was interested in why Jetbrains created yet another JVM language, so I did some research on the internet some time ago. The above is from memory, but you should be able to find the same using Google and looking at Kotlin blogs/talks.