Philosophy: the main purpose - kotlin is pragmatic language. The main idea of it: exclude the most frequent boilerplate.
A lot of classes, which are used in the C#/Java have only one constructor with the following semantic:
- Part of parameters are stored into the fields (with the same names)
- Part of parameters are used by constructor to create other field (or extra validation)
Moreover, a lot of secondary constructors are used to call the primary constructor with default values (please see this question for C# language)
Therefore: to have simplified code (which reflects essence) you have to have ability to:
- Support constructor parameters, which will be stored into the fields automatically (without
this.myData = myData
)
- Support ability to create field from constructor parameters
Both of items above required, therefore all constructors have the same input values (because all fields should be initialized, however they are set out of constructor body). Therefore you have to have primary constructor, which will do initialization.
After this logic applying we get major rule: to cover the most frequent class initializing scenarios you have to have primary constructor with ability to define default parameter values. Additionally you should have ability to create secondary constructors to cover all other scenarios.
So, I repeat the main idea: primary constructor is needed to cover the most frequent cases (pragmatic purpose)