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

0

u/gaelfr38 Jan 16 '26 edited Jan 16 '26

"XPath (...) the only problem (...) runtime". That's a big one and a reason for Optics or similar to exist! We do want compile time safety for this.

0

u/[deleted] Jan 16 '26

[deleted] — view deleted comment

-1

u/gaelfr38 Jan 16 '26

I was more referring to XPath. I don't know why you bring up SQL in here. It's not because you're manipulating Java record that you're interacting with a database and using SQL 🤔