[Rant] As a C++ programmer Kotlin's class definitions make me irrationally angry
Example:
class Rectangle(val width: Int, val height: Int) {
val area: Int
get() = this.width * this.height
}
You have class members implicitly being defined by virtue of being arguments of the constructor. (You can't have arguments that aren't members?) The constructor is defined by hijacking the class definition, and then you can expand the constructor logic by strewing init blocks throughput the class's body. This massively obfuscates the shape of the object and the flow of object creation. Then you have the getter definition... what? So "get" is a keyword that gets special meaning if it follows a variable definition. That's the context marker; it directly follows a definition?! There's no delineation or explicit reference to the target member, and you're merely expected to make it clearer by indenting?! Though I'm sure many programming languages had comparable syntax in 1980.
For context, I'm just starting out learning Kotlin, and I'm a hobbyist. If somebody could explain to me in which scenarios the Kotlin approach makes sense, I'd be very grateful. I just needed to vent.