[swift-evolution] C-style For Loops

David Smith david_smith at apple.com
Thu Dec 3 17:41:40 CST 2015


> On Dec 3, 2015, at 3:36 PM, Douglas Gregor <dgregor at apple.com> wrote:
> 
> 
>> On Dec 3, 2015, at 3:32 PM, Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
>> 
>> Does Swift still needs C-style for loops with conditions and incrementers? 
>> 
>> <Screen Shot 2015-12-03 at 4.30.15 PM.png>
>> 
>> 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.
> 
> My intuition *completely* agrees that Swift no longer needs C-style for loops. We have richer, better-structured looping and functional algorithms. That said, one bit of data I’d like to see is how often C-style for loops are actually used in Swift. It’s something a quick crawl through Swift sources on GitHub could establish. If the feature feels anachronistic and is rarely used, it’s a good candidate for removal.
> 
> 	- Doug
> 
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

Every time I’ve used a C-style for loop in Swift it was because I forgot that .indices existed. If it’s removed, a fixme pointing that direction might be useful.

	David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151203/7c334f1b/attachment-0001.html>


More information about the swift-evolution mailing list