[External] : Effectively final loop counter (was: Are templated string embedded expressions "method parameters" or "lambdas"?)
Brian Goetz
brian.goetz at oracle.com
Sun Oct 31 13:47:12 UTC 2021
> This is a somewhat separate topic but I would be glad to see some
> improvement here with respect to good old for loops, as I often saw
> copying to a new variable for the sake of lambda capture inside the
> loop.
As a separate separate topic, I'd like to make good-old-for-loops more
of a thing of the past.
For example, there's a reasonable stacking of features atop Valhalla
that gets us to:
for (int i : 0..<n) { ... }
with no performance overhead (e.g., no Iterator creation.)
My point is not to dive into the stack of features that get us there,
but to point out that the "enhanced" for loop, which is currently
extremely limited, has some legs to be generalized to the point where
old-school for loops might look more quaint. So I'd rather spend energy
on that, rather than rehabilitating the borrowed-from-C for loop.
More information about the amber-spec-experts
mailing list