<div dir="ltr"><div dir="ltr">On Fri, Oct 25, 2024 at 10:02 AM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com">archie.cobbs@gmail.com</a>> wrote:</div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Is there some quasi-consensus to go forward with this idea for fixing basic for() loops?</div></div></div></blockquote><div><br></div><div>(Hmm, nobody responded yes and nobody responded no...)<br></div><div><br></div><div>Now that JDK 24 is out of the way, I'd like to get some kind of final adjudication on whether to continue pursuing this idea from this list.</div><div><div><br></div><div>If everyone is good with doing this then I'm happy to continue working on it, otherwise I'm happy to 
shelve it. I would just like to tie up the loose end one way or another.<br></div><div><br></div></div><div>To recap: the idea is to allow loop variables declared in basic (old style) for() loops to be captured in the body of the loop as long as they are not reassigned in the body of the loop (but they may be reassigned in the loop step). For example:</div><div style="margin-left:40px"><pre class="gmail-notranslate"><span class="gmail-pl-k">for</span> (<span class="gmail-pl-smi">int</span> <span class="gmail-pl-s1">i</span> = <span class="gmail-pl-c1">1</span>; <span class="gmail-pl-s1">i</span> <= <span class="gmail-pl-c1">3</span>; <span class="gmail-pl-s1">i</span>++) {
    <span class="gmail-pl-smi">Runnable</span> <span class="gmail-pl-s1">r</span> = () -> <span class="gmail-pl-smi">System</span>.<span class="gmail-pl-s1">out</span>.<span class="gmail-pl-en">println</span>(i);   // allow this
}</pre></div><div><div>There was lots of good discussion and we did narrow down the idea to what's described above. However I'm unclear on whether to now proceed with asking for additional reviews, etc. and don't want to presume.</div><div><br></div><div>If nobody replies I won't ask again :)<br></div><br><div>FWIW here's what has been drafted so far (all subject to improvement of course):<br></div><div><br></div><div>Bug: <a href="https://bugs.openjdk.org/browse/JDK-8341782" target="_blank">https://bugs.openjdk.org/browse/JDK-8341782</a></div><div>CSR: <a href="https://bugs.openjdk.org/browse/JDK-8341783" target="_blank">https://bugs.openjdk.org/browse/JDK-8341783</a><br>JEP: <a href="https://bugs.openjdk.org/browse/JDK-8341785" target="_blank">https://bugs.openjdk.org/browse/JDK-8341785</a><br>JLS: <a href="https://bugs.openjdk.org/browse/JDK-8341786" target="_blank">https://bugs.openjdk.org/browse/JDK-8341786</a><br>PR: <a href="https://github.com/openjdk/jdk/pull/21415" target="_blank">https://github.com/openjdk/jdk/pull/21415</a></div><div><br></div><div>Thanks,</div><div>-Archie</div><div><br></div></div></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>