[swift-evolution] A (better) Swift Equivalent For The Classical For-Loop With Numeric Scalars

Tino Heth 2th at gmx.de
Sun Mar 20 08:06:43 CDT 2016


Imho the syntax of the deprecated for-loop was no good fit for Swift, but I've read several rumors about inferior performance of the alternatives…. so, as a basis for further discussion, I'd like to see some reliable numbers:
I expect that every loop can be expressed in Swift 3 with identical runtime and memory characteristics, but I'm not sure if this can be achieved with for-in, instead of a more complicated transformation that uses while.

Arguing about syntax is always subjective, but it's hard to justify the complete removal of the classic for-loop if the "modern" constructs can't compete with it.


More information about the swift-evolution mailing list