<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><font face="HelveticaNeue" class=""><b class="">Review of SE-0007</b></font></div><div class=""><font face="HelveticaNeue" class=""><b class=""><br class=""></b></font></div><div class=""><font face="HelveticaNeue" class=""><b class="">* What is your evaluation of the proposal?</b></font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">This is a sensible change. I am in favor of it.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class=""><b class="">* Is the problem being addressed significant enough to warrant a change to Swift?</b></font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">In isolation, the problem appears too small to warrant a change — just a little cruft in the language, an unnecessary but mostly harmless remnant of Swift’s ancestry. The C-style for loop is not a common source of programmer error, and is easy for the compiler to implement.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">However, in aggregate, cruft like this leads to language bloat and stagnation. In a garden, a single weed is not a problem, but <i class="">never weeding</i>&nbsp;is a significant problem.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><span style="font-family: HelveticaNeue;" class="">We have a feature that is:</span><br style="font-family: HelveticaNeue;" class=""><br style="font-family: HelveticaNeue;" class=""><span style="font-family: HelveticaNeue;" class="">1. not widely used,</span><br style="font-family: HelveticaNeue;" class=""><span style="font-family: HelveticaNeue;" class="">2. easily replaced with other languages features where it is used, and</span><br style="font-family: HelveticaNeue;" class=""><span style="font-family: HelveticaNeue;" class="">3. inconsistent with the language’s general aesthetic.</span><br style="font-family: HelveticaNeue;" class=""><br style="font-family: HelveticaNeue;" class=""><span style="font-family: HelveticaNeue;" class="">Observation, theory, and taste agree. If this isn’t a feature to remove for the health of the language, then what is? If we do not pull this weed, then what weed would we ever pull?</span></div><div class=""><span style="font-family: HelveticaNeue;" class=""><br class=""></span></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class=""><b class="">* Does this proposal fit well with the feel and direction of Swift?</b></font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">Yes.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">1. Swift tends to favor concise language constructs over boilerplate code for common patterns (e.g. didSet, lazy, optional unwrapping conveniences). This makes the C-style for out of place for the two common cases, counting and collection iteration, both of which already have more Swift-like alternatives.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">2. The ++ and&nbsp;— operators are already slated for removal, which makes the C-style for much less compelling.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><span style="font-family: HelveticaNeue;" class="">3. Swift tends to encourage immutability. It’s a minor detail, but the fact that the C-style for rules out immutability for the index variable is particularly compelling to me:</span></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo; color: rgb(102, 139, 73);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">for</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> i </span><span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">in</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">..&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">16</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp;&nbsp; </span>// i is immutable by default</div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">for</span> <span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">let</span> i = <span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">0</span>; i &lt; <span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">16</span>; i++&nbsp;&nbsp;<span style="font-variant-ligatures: no-common-ligatures; color: #668b49" class="">// doesn't work</span></div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class=""><br class=""></div></div><div class=""><font face="HelveticaNeue" class="">4. The few cases raised on the list where C-style for <i class="">might</i> still be preferable over other loop constructs all involve subtle interaction between the iterator clause (third part of the “for”) and break/continue/return. When I’ve seen this kind of code in the wild, at least in my own experience, it (1)&nbsp;</font><span style="font-family: HelveticaNeue;" class="">usually is brittle and in need of rewriting, and</span><font face="HelveticaNeue" class="">&nbsp;</font><span style="font-family: HelveticaNeue;" class="">(2) </span><font face="HelveticaNeue" class="">tends to appear only in low-level system libraries and graphics-related bit-twiddling, neither of which seem like Swift’s areas of focus. (Swift’s favoring of explicit scalar type conversion and precision safety already make it ill-suited to low-level bit twiddling.)</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class=""><b class="">* If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?</b></font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class="">Ruby does not have a C-style for loop. I’ve used Ruby extensively since 2007, and have not once felt that I wanted a C-style for.</font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div><div class=""><font face="HelveticaNeue" class=""><b class="">* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?</b></font></div><div class=""><br class=""></div></div></div><div class="">An hour or two. I’ve followed the discussion on the mailing list. I did a programmatic search of all of my own Swift code; I’ve never used the C-style for in Swift.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 2:44 PM, Douglas Gregor via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello Swift community,<br class=""><br class="">The review of "Remove C-style for-loops with conditions and incrementers” begins now and runs through&nbsp;Thursday, December 10th. The proposal is available here:<div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0007-remove-c-style-for-loops.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0007-remove-c-style-for-loops.md</a></div><div class=""><br class=""></div><div class="">Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div><div class=""><br class=""></div><div class="">or, if you would like to keep your feedback private, directly to the review manager.</div><div class=""><br class=""></div><div class="">What goes into a review?</div><div class=""><br class="">The goal of the review process is to improve the proposal under review through&nbsp;constructive criticism and, eventually, determine the direction of Swift. When&nbsp;writing your review, here are some questions you might want to answer in your&nbsp;review:<br class=""><br class=""><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>*&nbsp;What is your evaluation of the proposal?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>*&nbsp;Is the problem being addressed significant enough to warrant a change to&nbsp;Swift?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>*&nbsp;Does this proposal fit well with the feel and direction of Swift?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>*&nbsp;If you have you used other languages or libraries with a similar feature, how do&nbsp;you feel that this proposal compares to those?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>*&nbsp;How much effort did you put into your review? A glance, a quick reading, or&nbsp;an in-depth study?<br class=""></div><br class=""></div><div class="">More information about the Swift evolution process is available at</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/apple/swift-evolution/blob/master/process.md" class="">https://github.com/apple/swift-evolution/blob/master/process.md</a></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Cheers,</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Doug Gregor</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Review Manager</div><div class=""><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=zCg-2FSGF9Wk188a6c55kLyEbrj7YhaXxFEHM-2F-2B0YAlzUhXEfxKbMRtEo9s-2Fk-2BQHGNcdI9LHXaGcecq5GA9Ppj6k5VDls8SaBtXuBpAOBumjPSX8MfDfcj9h1jascrBnf0KKkzlv4lAjo-2BCeySxIW7ZoKVZVYBb9Tz59MzaqNZLd3kLf-2BAe7Ee9BxRwqaAhdgtmNkuhxoMkgzl563iPTPgOQwf64a-2BAzMkntriJQIwf6o-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>