I’m still a fan of data classes simply because they’re more flexible. Not only do you get the copy method, you can also use them where immutability isn’t desired. As much as I love immutability, sometimes we need something different. It’s the same with imperative vs. declarative programming. Sure, the latter is usually preferable, but I’d like the programming language to be flexible about it.
Now, if it ever turns out that a stricter version of data classes is beneficial, it can still be introduced. Simply add a modifier, like
strict data class
or even
record class
, and then we can use that as well.