<@U0EACPP46> I would solve your example by overloa...
# language-proposals
v
@natpryce I would solve your example by overloading
printStat
to accept
Score
directly. Assuming this did not work for you real use case, what was the problem with it?
b
He said that's like his current solution, but it's so much boilerplate it leaves a bad taste in his mouth [my words]
v
I really don't get it. If we raise the level of abstraction by combining values into data classes and then working with those classes, it should be reflected in the code. Since the function
fun printStat(score: Score)
I proposed should only be written once, I can't count it as boilerplate.
b
Yes, the particular function would be written once, but I get the sense that this is a common thing he does. For example, an
equals
function is something you only write once, but that "once" is multiplied across all classes. This is why it's generated in `data class`es. The same argument can be applied to this: Why require them to write a specialized function that takes in a specialized type and generifies it for every specialized type, when you can just make the generified functions destruct a
data class
?
v
I was trying to understand the scale of the problem
b
My guess is that this pattern would be as common as a
for
loop