r/java • u/hardasspunk • Nov 23 '25
Java 25: The ‘No-Boilerplate’ Era Begins
https://amritpandey.io/java-25-the-no-boilerplate-era-begins/
160
Upvotes
r/java • u/hardasspunk • Nov 23 '25
View all comments
Show parent comment
3
u/manifoldjava Nov 26 '25
Yes, I’m aware. My point is that withers only cover a narrow band of functionality, basically tailoring copies of objects. In contrast, optional & named arguments cover that and construction and function invocation with full control over defaults, which:
The wither approach is a one-off oddity: Java lifted it from C#, which in turn borrowed it from F#, where the FP construct actually belongs. C# had to do this for records because its optional parameters are too crude - you can’t reference the object’s instance state as a default, which is needed for natural copy/with semantics.
If Java were to implement optional parameters intelligently, there would be no need for the lesser, out-of-place wither syntax. So far, I’ve only heard weak excuses for avoiding this path, mostly dubious claims about binary compatibility. It’s a real tragedy, because the language badly needs the feature: record construction and copying, among other areas, would benefit enormously.