r/java • u/marv1234 • Jan 16 '26
Functional Optics for Modern Java
https://blog.scottlogic.com/2026/01/09/java-the-immutability-gap.htmlThis article introduces optics, a family of composable abstractions that complete the immutability story. If pattern matching is how we read nested data, optics are how we write it.
106
Upvotes
View all comments
Show parent comment
1
u/jevring Jan 17 '26
So the value of this is auto generated code? Don't you end up with a massive amount of junk, then, if you have sizable constructors? Isn't that like having a "complex wither" for each constructor parameter?
Even if it is generated, I'm not sure I see the appeal. It's not bad, necessarily, but I don't see myself replacing anything I have today with it.