<div dir="ltr"><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2024 at 9:19 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 dir="ltr">On Wed, Dec 11, 2024 at 2:25 PM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com" target="_blank">archie.cobbs@gmail.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 dir="ltr"><div>There is a (small) language change under consideration on amber-dev, and opinions have been expressed in multiple directions, so I'm turning to this list for hopefully some authoritative adjudication.</div></div></blockquote><div><br></div><div>Since I didn't hear an overwhelming roar of approval, I'll shelve this for now. The issues and PR will still be there if/when we want to take this up again in the future.</div><div><br></div><div>Thanks,<br></div><div>-Archie<br></div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div></blockquote><div><br></div><div>
<div>I know I'm late on this, but I think the right way to 
address deficiencies like this in old-style for loops is to make enhanced for loops better in ways that reduce/eliminate the need for old-style for loops.
That approach has been very successful with enhanced switch.<br></div><div><br></div><div>A simple and efficient way to use
 a simple range or arithmetic progression in enhanced for loops could replace 99% of uses of old-style for loops.<br></div><div><br></div><div>
Since there's no such thing as PrimitiveIterable, I presume that will 
require primitive specialization (JEP 218) from Valhalla. Primitive 
specialization will make it possible to use Iterable<int> 
instead of Iterable<Integer>.<br></div><div><br></div><div>A 
second, orthogonal improvement would be ImmutableIterator and 
ImmutableIterable interfaces that the enhanced for loop understands, 
making it possible to write value-based iterators.</div><div><br></div><div>In addition to being able to lambda-capture the loop variable, "for (final int i : Range.closed(0, 9)) {...}" is much easier to read (and less vulnerable to off-by-one errors) than the old-style for loop "for (int i = 0; i <= 9; <a class="gmail_plusreply" id="plusReplyChip-1">++i) {...}"</a><br></div><div><br></div><div>Cheers,</div><div>Clement</div>  <br></div></div></div>