Lambda in data class
I’m having a discussion with my team, trying to convince them not to use lambdas in a data class.
Example:
data class Data(val name: String, val callback: () -> Unit)
There are no recommendations in the documentation whether it is a valid use case.
My understanding is that a lambda introduces more then 1 issue into such a data class:
lambda is not comparable by value, so having a generated equals and hashcode does not add any value.
lambda may wrap mutable refs
passing around such a data...