<p dir="ltr">The reason I said it is "common" is because it is something you see a lot when you search "java read from buffer" in Google (3 out of the first 5 result, including stack overflow and Baeldung post.</p>
<p dir="ltr">Similarly to "java read from inputstream" (excluding the javadoc result, which doesn't have an example on how to use inputstreams)</p>
<p dir="ltr">(SO and Baeldung seems to really like this pattern)</p>
<p dir="ltr">So I really meant "common" when I said "common", my sample was just different from yours.</p>
<p dir="ltr">But even if we disagree on the usage of "common", I still my point is still standing </p>
<br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 21 Oct 2024, 20:53 Brian Goetz, <<a href="mailto:brian.goetz@oracle.com">brian.goetz@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
  <div>
    <font size="4" face="monospace">I've noticed people often use the
      word "common" when they mean something else.  This is usually
      relative to their own personal experience: "I commonly see..." 
      But that doesn't necessarily make them "common"; if you did a
      query over all of Github, the percentage of loops that are of this
      "common" idiom would surely be ... vanishingly uncommon.  <br>
      <br>
      I think what you mean is "not unheard of".<br>
    </font><br>
    <br>
    <div>On 10/21/2024 1:37 PM, Holo The Sage
      Wolf wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="auto">
        <p dir="ltr">I disagree with the idea that "ranges" replace
          loops.</p>
        <p dir="ltr">It is a common to see stuff like:</p>
        <p dir="ltr">for(var x = buffer.read(); x != -1; x
          =buffer.read())</p>
        <p dir="ltr">Or</p>
        <p dir="ltr">while((x = buffer.read()) != -1)</p>
        <p dir="ltr">In both cases, x is most likely (effectively)
          frozen inside the loop-clause, there is no reason to not treat
          it as (effectively) frozen.</p>
        <p dir="ltr"><br>
        </p>
        <p dir="ltr">Yes it is technically possible to wrap those in
          Iterable, but I don't see this pattern die any time soon</p>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Mon, 21 Oct 2024, 20:22
          Kevin Bourrillion, <<a href="mailto:kevinb9n@gmail.com" rel="noreferrer noreferrer" target="_blank">kevinb9n@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">well, uhh, "nay" :-) 
            <div><br>
            </div>
            <div>But seriously, I don't disagree that in Example A it's
              more than sufficiently unambiguous which value the
              developer wants. I just feel like this whole topic is
              uncomfortably intricate and messy, and the specific
              benefits of the change don't feel to me like they will
              ever be worth even the time that's <i>already</i> gone
              into discussing it, especially when (as Tagir said) what
              users really want is loops over ranges anyway.</div>
            <div><br>
            </div>
            <div>To me changing nothing feels like winning here, but
              that's just me.</div>
            <div><br>
            </div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Mon, Oct 21, 2024 at
              10:00 AM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">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 dir="ltr">On Mon, Oct 21, 2024 at 11:36 AM Maurizio
                  Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com" rel="noreferrer noreferrer noreferrer" target="_blank">maurizio.cimadamore@oracle.com</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>
                      <p>What I'm trying to say is that if a developer
                        is confused (by the i++) on what "frozen" means
                        for a loop variable, they won't find any clarity
                        in our explanation that "lexically scoping
                        trumps everything else". E.g. whether a
                        developer reads the STEP part of a loop as part
                        of the body (after the end of the body) or not
                        is, I believe, a very subjective thing - and one
                        which affects how any change we make in the area
                        will be perceived (IMHO).</p>
                    </div>
                  </blockquote>
                  <div>Yes, if a developer is mentally cutting and
                    pasting the STEP onto the tail of the BODY then
                    you're right, that makes it appear as if the
                    variable is not really "frozen".<br>
                  </div>
                  <div><br>
                  </div>
                  <div>But the original basic for() proposal has the
                    analogous problem - i.e., if a developer is mentally
                    cutting and pasting the STEP onto the tail of the
                    BODY, then in the original proposal the variable no
                    longer appears to be "effectively final in the body
                    of the loop".</div>
                  <div><br>
                  </div>
                  <div>So it seems to me that this proposal and the
                    original basic for() proposal suffer equally in that
                    particular respect, and such a developer is not
                    going to be satisfied by either of these new mental
                    models.<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>
                      <p>Of course, as with every new proposed feature,
                        we hear a lot from developers who think that the
                        new proposal addresses a specific pain point
                        that they thought should never existed in the
                        first place. But we tend to hear less about a
                        less vocal portion of users who might just be
                        silently ok with the status quo. Or maybe, in
                        this instance, we don't hear from them because
                        they aren't there (although, Tagir expressed
                        some concerns [1], so I have to assume there are
                        such developers out there  _somewhere_ :-) )<br>
                      </p>
                    </div>
                  </blockquote>
                  <div>I too would like to hear more opinions... speak
                    up, naysayers :)<br>
                  </div>
                  <div><br>
                  </div>
                  <div>-Archie<br>
                  </div>
                </div>
                <br>
                <span class="gmail_signature_prefix">-- </span><br>
                <div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
                </div>
              </div>
            </blockquote>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div>