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

Charles Srstka cocoadev at charlessoft.com
Sat Mar 19 17:57:33 CDT 2016


The thing that I like about classical for loops is the ability to declare a variable for the iteration whose scope is limited to the loop. While you can replicate the functionality of a classical for loop with while, this requires declaring the variable outside of the scope of the loop.

Charles

> On Mar 19, 2016, at 1:31 PM, Ross O'Brien via swift-evolution <swift-evolution at swift.org> wrote:
> 
> But the discussion is no longer about 'do we really need to take this feature out?'. The feature is already out. It's deprecated in Swift 2.2. The discussion is 'is there a compelling reason to put it back in again?'.
> 
> We still have for-in loops. We still have repeat while. We still have forEach. Iteration isn't going anywhere; it just doesn't have this peculiar semi-colon structure any more. It's a confusing structure for beginning programmers to learn in the first place, and Swift doesn't use semi-colons so much.
> 
> On Sat, Mar 19, 2016 at 6:06 PM, Patrick Gili via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
>> On Mar 18, 2016, at 7:19 PM, Ted F.A. van Gaalen <tedvgiosdev at gmail.com <mailto:tedvgiosdev at gmail.com>> wrote:
>> 
>> On Chris’s advice, I’ve spawned this into a new discussion topic, for which the base could be
>> part of what I wrote in relation to SE-0007. 
>> 
>> 
>> Hello Patrick
>> as I wrote: 
>> As a result of removing the classical for loop it is to be expected that lot of people might consider thinking twice about switching to Swift, If they have to live without (or cumbersome work around) language elements that have proven to be very useful for at least a few decades...
> 
> There are two groups of people to consider:
> 
> 1) OS X and iOS developers; this group is stuck with whatever the language brings them, for good or bad. If this group of people doesn't like a decision made by the community, they can grumble about it for awhile, suck in a deep breath, and move on.
> 
> 2) Others; this group may be considering using Swift to develop software on other platforms and in other environments. If this group of people doesn't like a decision made by the community, they may think twice and it could significantly impact the uptake by this group of developers. I think it is wise that the community lubricate the transition to Swift as much as possible for this group of developers. I ask if leaving this kind of syntax in the language is so bad? Does it fall in the same category as removing function currying? My gut tells me not, but I could be wrong.
> 
>> 
>> I also find it of the most importance to keep Swift accessible for all kinds of programmers
>> from starters to academic. 
>> 
>> Graig Federighi said 
>> We think it should be everywhere and used by everyone.
>> 
>> 
>> I subscribe to that.
>> 
>> 
>> -TedvG
>> 
>> 
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160319/54a37c54/attachment.html>


More information about the swift-evolution mailing list