<div dir="ltr"><div>I am looking at JEP Derived Record Creation. <a href="https://openjdk.org/jeps/8321133">https://openjdk.org/jeps/8321133</a> I see the following example.<br></div><div></div><div>
<pre><code>Point nextLoc = oldLoc with {
x *= 2;
y *= 2;
z *= 2;
};<br><span style="font-family:arial,sans-serif"><br></span></code><span style="font-family:arial,sans-serif">If the body of the wither becomes more complex, then this will make reading the code difficult. For example, there could be a deep nesting of wither.<br></span></pre><pre><span style="font-family:arial,sans-serif">Lambdas can also be nested. However, the best practice is to move multiline lambda bodies into a separate method and leave behind a single line that calls the method. The ability to move the lambda bodies to another method allows for simplification of the code and improves readability.<br><br></span></pre><pre><span style="font-family:arial,sans-serif">Can we change the design to allow withers to be moved to another method? I ask without thinking through the ramifications. If withers can't be moved to another method, how do we eliminate nesting and other complexities?</span>
</pre>
</div></div>