r/java • • Jun 10 '22

What happened to Concise Method Bodies?

I was really looking forward to CMB. From its name, methods become concise, could be one liner. However, it seems there is no progress and it’s been off the radar. Never took off since 2019.

JEP draft: Concise Method Bodies

some experiments with Concise Method Bodies

43 Upvotes

54 comments sorted by

View all comments

Show parent comment

9

u/hippydipster Jun 10 '22 edited Jun 10 '22

In fact, "withers" would be even worse than getters and setters, since while a class might have O(n) getters, it could conceivably have O(2n) withers. Worse, as the number of components grows, the bodies of these "wither" accessors gets more error-prone. Let's nip this one in the bud before it becomes a "pattern" (or worse, a "best practice".)

Having written a lot of withers, I couldn't agree more. I really like this Goetz guy.

I also really like the idea of the deconstructors and reconstructors, and I can't wait to see with blocks nested 5 layers deep!