<div dir="ltr"><div dir="ltr"><div>FYI, I've created a draft PR prototyping this, using the "spooky action at a distance" approach.</div><div><br></div><div><a href="https://github.com/openjdk/jdk/pull/20976">https://github.com/openjdk/jdk/pull/20976</a></div><div><br></div><div>-Archie<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 11, 2024 at 10:05 AM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com">archie.cobbs@gmail.com</a>> wrote:<br></div><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>Hi Robbe,<br></div><div dir="ltr"><br></div><div dir="ltr">On Wed, Sep 11, 2024 at 12:09 AM Robbe Pincket <<a href="mailto:robbepincket@live.be" target="_blank">robbepincket@live.be</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div dir="auto">If we just add a clause in 4.12.4 that says that if the variable is declared in a for loop header and appears as the left side of an assignment or compound assignment or as the argument of a postfix/prefix increment/decrement operator, it isn't
considered to be a constant variable.</div>
<div dir="auto"><br>
</div>
<div dir="auto">I don't think that this breaks any existing code. As (non-blank) final variables can't appear in those locations.</div></div></blockquote><div><br></div><div>Agreed... that's what I'm calling the "spooky action at a distance" approach.</div><div><br></div><div>Although it's less graceful from a spec point of view, practically speaking it's probably the only acceptable solution because the alternative would break existing code (in a very narrow corner case).<br></div></div></div>
</blockquote></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>