Re:Data Classes for Java
by Naac on Wednesday November 01, 2017 @10:21PM
(#15607320)
and
are very different. In this case the builder pattern is more powerful as it lets you pass around builders that haven't been "built" yet. Kind of like currying.
[ Parent
| on HN ]
True, but the constructor method is checked/validated at compile time vs. run time with the builder pattern. Not quite the same as your example, but Kotlin does have good syntax for copying data classes while only changing a single field - this could be used similar to your currying usage.
https://kotlinlang.org/docs/reference/data-classes.html#copy...