[swift-evolution] C-style For Loops

Colin Cornaby colin.cornaby at mac.com
Fri Dec 4 16:33:56 CST 2015

I was talking with people in the office about this proposal today, in since there has been such a long discussion already I'll just reply to the top of the tree just to get our take in before the review...

It's understood that Swift has better, more readable ways to do for loops, but C style for loops reduce friction for getting our C or C++ developers on board with Swift. Unless there is a gain elsewhere to be made in their removal, it would be nice to keep them. As we transition to Swift we can educate developers on better ways to iterate, but it would be nice to have one less thing in the way of getting people writing Swift code.

We work on a lot of algorithmic code which would be well suited for Swift. And again, I understand that C style for loops are redundant. But it's just one less speed bump in understanding for some of our developers or for porting pure C or C++ code without having to do as much re-validation of algorithms for accidental changes.

But if it's actively hurting some other part of the language we could probably be talked into it.

On Dec 03, 2015, at 03:32 PM, Erica Sadun <erica at ericasadun.com> wrote:

Does Swift still needs C-style for loops with conditions and incrementers? 

More Swift-like construction is already available with for-in-statements and stride. 
This would naturally starve the most common point for -- and ++ operators as well.

-- E

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151204/129946cd/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2015-12-03 at 4.30.15 PM.png
Type: image/png
Size: 27490 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151204/129946cd/attachment-0001.png>

More information about the swift-evolution mailing list