Review on SE-0007 (Remove C-style for-loops with conditions and incrementers)


(Nicky Gerritsen) #1

Hi all,

Just wanted to give my opinion on this proposal :). Let’s go through it following the suggested questions.

What is your evaluation of the proposal?
I am 100% in favor of doing this. I think Erica makes good points and clearly explains what the impact on existing code is. In my opinion this impact is not too big, because - as Erica suggests - I believe only people coming from languages that have the C-style for-loop use it and only when starting with Swift.
Now that ++ and — are gone, I think it is indeed a good time to get rid of this C-style for-loop as well.

Furthermore, Erica typed "using familiar constants and control structures. The for-loop mimics C and limits the effort needed to master this control flow.”. But I think that people who come from a C-style language have enough skills to know how loops work and can easily adapt their code to the for-in syntax.

Is the problem being addressed significant enough to warrant a change to Swift?
Yes I think that this will make the language less “cluttered” and it will probably also make the language implementation easier.

Does this proposal fit well with the feel and direction of Swift?
As already stated by others and by Erica, the C-style for-loop does not feel “Swifty” at all and removing it will thus be good for the direction of Swift.

If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
I can’t really think of another language I used from the top of my mind that did not have a C-style for-loop, sorry.

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
I read the proposal thoroughly and also read other peoples remarks on it. Furthermore I did some digging in our code and found one spot where I used the C-style for loop, which I trivially rewrote to use ..<

Conclusion
Get rid of it ;). Furthermore, great job to Erica for putting her time into this proposal :).

Regards,

Nicky