Re:Swift 3.0 Release Process
by masklinn on Saturday May 07, 2016 @05:41AM
(#11648980)
> for-in doesn't tell you the index of the current object so you'd have to manually keep track of the index.
Functional decoration trivially provides that. Just zip a counter with the backing iterable, and modern languages generally provide that OOTB as a variant of `enumerate()` e.g.
for i, item in it.enumerate():
# stuff
> Also, x++ is a common syntax in many languages
Meh. It's generally present in B derivatives (via C) and that's pretty much it. Most languages do just fine without it.
Functional decoration trivially provides that. Just zip a counter with the backing iterable, and modern languages generally provide that OOTB as a variant of `enumerate()` e.g.
> Also, x++ is a common syntax in many languagesMeh. It's generally present in B derivatives (via C) and that's pretty much it. Most languages do just fine without it.