<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="">Cool! Thanks for updating the proposal with those concerns!<div class=""><br class=""></div><div class="">One thing though, could you possibly change</div><div class=""><br class=""></div><div class=""><pre style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal; color: rgb(119, 119, 119);" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">for</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> x <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">0</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">while</span> (someCondition()) {</pre><div class="">to be&nbsp;</div></div><div class=""><pre style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal; color: rgb(119, 119, 119);" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">for</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> x <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">0</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">while</span> someCondition() {</pre><div class="">in the gist?</div><div class=""><br class=""></div><div class="">I accidentally threw and extra set of parenthesis in there. Old habits die hard.</div></div><div class=""><br class=""></div><div class="">Tyler</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 1:26 PM, Erica Sadun 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">A slightly updated proposal write-up with everyone's feedback:&nbsp;<a href="https://gist.github.com/erica/56d533b75d0a36e3908f" class="">https://gist.github.com/erica/56d533b75d0a36e3908f</a></div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 2:13 PM, Tyler Fleming Cloutier &lt;<a href="mailto:cloutiertyler@aol.com" class="">cloutiertyler@aol.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 16px;"><b class="">Lowered Readability and Maintainability</b></div><div class="" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 16px;"><br class=""></div><div class="" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 16px;">I have aesthetic reasons for disliking the for-loop. The C-style loop is harder to read especially for those not coming from C-style languages, easier to mess up at edge conditions, and is commonly used for side-effects which, in a language focused on safety, is not a feature to be encouraged.&nbsp;</div><div class="" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 16px;"><br class=""></div><div class="" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 16px;">For example, one side effect that was mentioned on-list yesterday was the incrementor, which is guaranteed in C-style to execute late:</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="font-size: 16px;">Roland King writes:</div><blockquote class="" style="font-size: 14px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div class="" style="font-size: 16px;"><br class=""></div><div class="" style="font-size: 16px;"><div class="" style="font-family: Palatino-Roman;">for var floatingThing = start ; floatingThing &lt;= end ; floatingThing += delta</div><div class="" style="font-family: Palatino-Roman;">{</div><div class="" style="font-family: Palatino-Roman;"><span class="Apple-tab-span" style="white-space: pre;">        </span>// more than a few lines of code with early escape continues</div><div class="" style="font-family: Palatino-Roman;">}</div><div class="" style="font-family: Palatino-Roman;"><br class=""></div><div class="" style="font-family: Palatino-Roman;">shows intent of the loop very clearly, start, condition and increment all together at the top, and however you loop you always execute the increment part of the statement. Convert that to a while(), if you have a continue in the body, you have a good chance of not incrementing at all, or duplicating the increment code before every continue. So you can’t always nicely turn for into while. I second the point below about the loop variable being local to the for as well, I also like that.&nbsp;</div><div class="" style="font-family: Palatino-Roman;"><br class=""></div></div></blockquote><span class="" style="font-size: 16px;">Late incrementor management is a feature that can be mimicked with defer, as pointed out by several other list members.</span><font face="Palatino-Roman" size="3" class=""><br class=""></font><blockquote class="" style="font-size: 14px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div class="" style="font-size: 16px;"><div class=""><br class=""></div></div></blockquote></div></blockquote><div class=""><br class=""></div><div class="">Defer wouldn’t accomplish the exact same behavior because it would run if an exception was thrown, which is not the same as the last clause of a for loop, but perhaps is close enough.</div><div class=""><br class=""></div><div class="">The only other concern I would have is not being able to scope my variables to the loop. I didn’t see it addressed, but perhaps its not very important in the end anyway.</div><div class=""><br class=""></div><div class="">Something like the following might be nice to scope the variable exclusively to the loop.</div><div class=""><br class=""></div><div class="">for var x = 0 while (someCondition()) {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>// code</div><div class="">}</div></div></div></div></blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=DOmV4Qxg-2B1XOnX4CfTyH3sCllXs7myBcgXMCpdkqNW3AsH8VOd9ktcmO-2FguWOyfObKI8MZ1Q7ztS4-2Fw0ESQTaVtei3x8INXSJVNnEDJ3UI23F4WNqVhfBx6z1HkHGyOSXhYi6f8-2Bc-2FljZV-2FBj7o8XfFfnAI89-2BVfnLq-2F2QKOUJmHJusqGvG8lUp19-2BhVIviQPMTN3NdiexjOHyFVuG6SRy9kVqh36fSbNOHE3AYLgn4-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=""></div></div></body></html>