<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><b class="">What is your evaluation of the proposal?</b><div class=""><b class=""><br class=""></b></div><div class="">Mild concern. I am not opposed to removing C-style for loops, but I do think that it leaves a hole in the language that should be filled by some other means, and I would prefer to figure that out before removing a useful feature.</div><div class=""><br class=""></div><div class=""><b class="" style="font-family: HelveticaNeue;">Is the problem being addressed significant enough to warrant a change to Swift?</b></div><div class=""><b class="" style="font-family: HelveticaNeue;"><br class=""></b></div><div class=""><span class="" style="font-family: HelveticaNeue;">Not obviously so. C-style for loops, while not particularly stylish, are “mostly harmless”. That said, some of their functionality is duplicated in for … in loops, so there is some overlap that might be cleaned up. Having a simpler language (if we can do so without compromising usability) is a good thing.</span></div><div class=""><span class="" style="font-family: HelveticaNeue;"><br class=""></span></div><div class=""><span class="" style="font-family: HelveticaNeue;"><b class="">Does this proposal fit well with the feel and direction of Swift?</b></span></div><div class=""><span class="" style="font-family: HelveticaNeue;"><b class=""><br class=""></b></span></div><div class=""><font face="HelveticaNeue" class="">For … in loops are more Swifty, and we should encourage people to use them where appropriate. </font><span style="font-family: HelveticaNeue;" class="">However, they are significantly less versatile than C-style for loops. My concerns, as a low-level library writer, are that:</span></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">- The loss of C-style for makes iterating backwards more complex than iterating forwards. This asymmetry is unnatural.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">- The loss of C-style for makes it significantly more complex to use strides that vary between iteration steps.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">In particular, the available replacements for the second issue force one to split the “loop control” over multiple lines in e.g. a while loop:</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var i = initialValue</font></div><div class=""><font face="HelveticaNeue" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>// possible intermediate stuff</font></div><div class=""><font face="HelveticaNeue" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>while i < terminalValue {</font></div><div class=""><font face="HelveticaNeue" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>// some loop contents</font></div><div class=""><font face="HelveticaNeue" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>i += update</font></div><div class=""><font face="HelveticaNeue" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">I have seen some proposals floated involving closures, but I don’t think any of these to pass the smell test. One of the chief virtues of the C-style loop is that it lets one gather all of the loop control in one place, which makes reading complex code much, much easier (if we keep C-style for, I would strongly support something like "for (let i = blah; … )” where i is immutable within the loop body for exactly this reason).</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">My biggest concern (the asymmetry of loops with stride -1) could be addressed by having a reasonable range operator for this case ("N >.. 0" or similar). I haven’t seen a really strong proposal yet for other loop structures, but I’m willing to write them off if we have a good story for -1 stride, which is the 99% case in my experience.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><b class="" style="font-family: HelveticaNeue;">If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?</b></div><div class=""><b class="" style="font-family: HelveticaNeue;"><br class=""></b></div><div class=""><font face="HelveticaNeue" class="">Every language I’ve used heavily either has a "c-style-for” structure, or is so utterly foreign to Swift as to offer no practical guidance here.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><b class="" style="font-family: HelveticaNeue;"> How much effort did you put into your review? A glance, a quick reading, or an in-depth study?</b></div><div class=""><b class="" style="font-family: HelveticaNeue;"><br class=""></b></div><div class=""><span class="" style="font-family: HelveticaNeue;">I’ve read all of the emails carefully, and spent a while looking for cases in my own code where I would really miss the current feature.</span></div><div class=""><span class="" style="font-family: HelveticaNeue;"><br class=""></span></div><div class=""><span class="" style="font-family: HelveticaNeue;">Thanks to everyone for taking time to contribute to this!</span></div><div class=""><font face="HelveticaNeue" class="">– Steve</font></div></body></html>