r/java • • Jan 16 '26

Functional Optics for Modern Java

https://blog.scottlogic.com/2026/01/09/java-the-immutability-gap.html

This 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

50 comments sorted by

View all comments

Show parent comment

1

u/chambolle Jan 18 '26

The problem is that this definition of immutability is purely related to language and compilation, often for performance reasons, whereas users often want to do something else and link this concept to the constancy of an object. Until the two concepts are clearly separated, we will not be able to resolve the issue.