Probably this question should go the authors of Kotlin, but I'm sure that on SO there are many Kotlin users with deep knowledge of its architecture.
So my question is: why the language doesn't support destructuring in when expressions?
For example I would like to have the following code:
data class Person(val name: String, val age: Int)
when (person) {
("John", _) -> print("It is John") //it won't compile
else -> print("It's not John")
}
As destructuring uses the component1, component2, etc.
methods I'm curious why this simple value comparison can't be used as shown above. Is the problem in modification of when
mechanism or the destructing itself?