<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="">It looks like my emails were being classified as spam by Gmail. Below are my earlier thoughts on the C-style For loop.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Hmm, yeah, that is definitely a good point. It can be easy enough to throw a continue into a while loop an completely skip the increment step. Of course you could add syntax to a while loop to allow for block/loop scoping of variables and then it might be tempting to add some finally logic to ensure that the incrementing is never skipped. Which, then what you have is a C style for loop with unfamiliar/unprecedented syntax, which would be silly.<br class=""><font color="#00afcd" class=""><br class=""></font>Perhaps the question is, is it worth keeping the C style around for loop syntax for these particular types of uses?<br class=""><font color="#00afcd" class=""><br class=""></font>On a total side note, I figure while I'm proposing silly things and decidedly terrible syntax, I might as well mention that when I originally began programming I was confused about the need for two different styles of loops. It seemed like "while" was a special case of "for" and was redundant (but made for a nicer looking syntax). An interesting thought experiment is to think about what dropping "while" might look like.<br class=""><font color="#00afcd" class=""><br class=""></font>Just like there is for-in<br class=""><font color="#00afcd" class=""><br class=""></font>for x in someGenerator {<br class=""><span class="" style="white-space: pre-wrap;">        </span>// code<br class="">}<br class=""><font color="#00afcd" class=""><br class=""></font>There could also be for-if-repeat and for-repeat-if<br class=""><font color="#00afcd" class=""><br class=""></font>for var x = 0 if x &lt; 7 repeat {<br class=""><span class="" style="white-space: pre-wrap;">        </span>// code<br class="">} then x + 7<br class=""><font color="#00afcd" class=""><br class=""></font>for var x = 0 repeat {<br class=""><span class="" style="white-space: pre-wrap;">        </span>// code<br class="">} if x &lt; 7 then x + 7<br class=""><font color="#00afcd" class=""><br class=""></font>or for-while-repeat and for-repeat-while if that syntax is preferred. Maybe not the most practical solution here, but I think fun to think about.&nbsp;</div><div class=""><br class=""><div class=""><div class=""><div class=""><div class="gmail_extra"><div class="gmail_quote"><div dir="auto" class=""><div class="">Tyler</div></div></div></div></div></div></div></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 1:24 PM, Tyler Cloutier &lt;<a href="mailto:tcloutier@machinezone.com" class="">tcloutier@machinezone.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span 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; float: none; display: inline !important;" class="">Hi Johan,</span><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;"><br class=""></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;">Thanks for the heads up. That probably means a number of the emails I sent went to spam. I’ll try sending from a different address from now on. I wonder though, why Gmail thinks it’s failing the tests. Avoidance of Gmail is the only reason I have an AOL address in the first place.</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;"><br class=""></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;">Thank you,</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;"><br class=""></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;">Tyler</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;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 1:20 PM, Johan Jensen &lt;<a href="mailto:jj@johanjensen.dk" class="">jj@johanjensen.dk</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" 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=""><div class=""><div class=""><div class="">(Replying privately)<br class=""><br class=""></div>Hey Tyler,<br class=""><br class=""></div>Just wanted to let you know, that your two recent emails arrived in the spam-folder on my GMail account and thus likely also in others spam-folder.<br class=""></div>Google has the following explanation: “<b class="">Why is this message in Spam?</b><span class="Apple-converted-space">&nbsp;</span>It has a from address in<span class="Apple-converted-space">&nbsp;</span><a href="http://aol.com/" class="">aol.com</a><span class="Apple-converted-space">&nbsp;</span>but has failed<span class="Apple-converted-space">&nbsp;</span><a href="http://aol.com/" class="">aol.com</a>'s required tests for authentication.”<br class=""><br class=""></div>—Johan<br class=""></div><div class="gmail_extra" 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;"><br class=""><div class="gmail_quote">On Sat, Dec 5, 2015 at 11:27 AM, Tyler Cloutier<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:cloutiertyler@aol.com" target="_blank" class="">cloutiertyler@aol.com</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="auto" class=""><div class="">Hmm, yeah, that is definitely a good point. It can be easy enough to throw a continue into a while loop an completely skip the increment step. Of course you could add syntax to a while loop to allow for block/loop scoping of variables and then it might be tempting to add some finally logic to ensure that the incrementing is never skipped. Which, then what you have is a C style for loop with unfamiliar/unprecedented syntax, which would be silly.</div><div class=""><br class=""></div><div class="">Perhaps the question is, is it worth keeping the C style around for loop syntax for these particular types of uses?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">On a total side note, I figure while I'm proposing silly things and decidedly terrible syntax, I might as well mention that when I originally began programming I was confused about the need for two different styles of loops. It seemed like "while" was a special case of "for" and was redundant (but made for a nicer looking syntax). An interesting thought experiment is to think about what dropping "while" might look like.</div><div class=""><br class=""></div><div class="">Just like there is for-in</div><div class=""><br class=""></div><div class="">for x in someGenerator {</div><div class=""><span class="" style="white-space: pre-wrap;">        </span>// code</div><div class="">}</div><div class=""><br class=""></div><div class="">There could also be for-if-repeat and for-repeat-if</div><div class=""><br class=""></div><div class="">for var x = 0 if x &lt; 7 repeat {</div><div class=""><span class="" style="white-space: pre-wrap;">        </span>// code</div><div class="">} then x + 7</div><div class=""><br class=""></div><div class="">for var x = 0 repeat {</div><div class=""><span class="" style="white-space: pre-wrap;">        </span>// code</div><div class="">} if x &lt; 7 then x + 7</div><div class=""><br class=""></div><div class="">Certainly an unnecessary change considering the problem at hand and has obvious downsides, but I think fun to think about.</div><div class=""><br class=""></div><div class="">Tyler<br class=""><div class=""><div class=""><br class=""></div></div></div><div class=""><br class="">On Dec 4, 2015, at 11:54 PM, Roland King &lt;<a class="">rols@rols.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class="">I must be the only person who still likes C-style for loops on occasion. eg a loop with something floating point&nbsp;<div class=""><br class=""></div><div class="">for var floatingThing = start ; floatingThing &lt;= end ; floatingThing += delta</div><div class="">{</div><div class=""><span class="" style="white-space: pre-wrap;">        </span>// more than a few lines of code with early escape continues</div><div class="">}</div><div class=""><br class=""></div><div class="">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=""><br class=""></div><div class="">In the float case yes you can use stride</div><div class=""><br class=""></div><div class="">for var floatingThing in start.stride( through : end, by : delta )</div><div class="">{</div><div class="">}</div><div class=""><br class=""></div><div class=""><div class="">but it’s not terribly pretty and you have to be sure whether you mean stride( through:, end:) or stride( to:, end:)</div><div class=""><br class=""></div><div class="">That’s not a problem with integers where you have the ‘0..&lt;n’ syntax which reads very clearly in a for .. in construct but in other cases the old c-style for can be a clearer read than for .. in with an iterator.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 5 Dec 2015, at 15:14, Tyler Cloutier &lt;<a class="">cloutiertyler@aol.com</a>&gt; wrote:</div><br class=""><div class=""><div dir="auto" class=""><div class="">Indeed. Python doesn't have it, and there isn't much concern about the learning curve or the missing functionality there, it seems. I actually didn't even realize it was missing from Python until I stopped and thought about it.</div><div class=""><br class=""></div><div class="">At first I was concerned about losing C style for loops, but I really can imagine a scenario in which they are more succinct while still maintaining clarity of intent. Plus they're a pain to type out.</div><div class=""><br class=""></div><div class="">From time to time when programming in C or JS I will include more than one statement or more complicated logic in the increment part of the for loop (perhaps move 2 indices in a complicated way), but perhaps that would be clearer just to implement as a while loop with the logic at the end.&nbsp;</div><div class=""><br class=""></div><div class="">One thing I will say is that it's nice to have your loop variables scoped to the loop, which is more difficult (impossible?) to accomplish with a while loop.</div><div class=""><br class=""></div><div class="">Perhaps some while loop syntax like:</div><div class=""><br class=""></div><div class="">while (x &lt; someThing) start var x = 0, y = 11 {</div><div class=""><span class="" style="white-space: pre-wrap;">        </span>x += someOtherThing</div><div class="">}</div><div class=""><br class=""></div><div class="">Which is decidedly terrible syntax, but that's kind of the idea anyway.</div><div class=""><br class=""></div><div class="">Tyler</div><div class=""><br class=""></div><div class=""><br class=""><br class=""><div class=""><div class=""><br class=""></div></div></div><div class=""><br class="">On Dec 4, 2015, at 3:21 PM, Colin Cornaby &lt;<a class="">colin.cornaby@mac.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div class="">This is a nice solution that translates nicely without creating too much concern about changing the nature of an algorithm in a complex system.<span class="Apple-converted-space">&nbsp;</span><img goomoji="1f44d" alt="👍" class="" style="margin: 0px 0.2ex; vertical-align: middle; max-height: 24px;"><br class=""></div><div class=""><br class=""></div><div class="">Should at least get a nice "fix it" in Xcode though. On survey, we do have developers using the C style syntax, but we're early in the process of transitioning.</div><div class=""><br class="">On Dec 04, 2015, at 02:52 PM, Johan Jensen &lt;<a class="">jj@johanjensen.dk</a>&gt; wrote:<br class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">With the removal of post/pre-increment/decrement you might as well translate C-style for-loops to something akin to<br class=""><br class=""></div>for var i in 0..&lt;10 {<br class="">&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span>...<br class="">}<br class=""><br class=""></div>If more advanced C-style for-loops are needed, I am sure most developers can use a while-loop (as mentioned by Ray Fix) until they get accustomed to Swift’s syntax.<span class="Apple-converted-space">&nbsp;</span><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Dec 4, 2015 at 11:37 PM, Joe Groff<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a class="">jgroff@apple.com</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><div class="">You might ease the pain by approximating C-style 'for' by a higher-order function:</div><div class=""><br class=""></div><div class="">func cStyleFor(@autoclosure init initializer: () -&gt; (), @autoclosure test: () -&gt; Bool, @autoclosure inc: () -&gt; (), body: () throws -&gt; ()) rethrows {</div><div class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>// left as an exercise</div><div class="">}</div><div class=""><br class=""></div><div class="">var i = 0</div><div class="">cStyleFor(init: i = 0, test: i &lt; 10, inc: ++i) {</div><div class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>print(i)</div><div class="">}</div><div class=""><br class=""></div><div class="">-Joe</div><br class=""><div class=""><blockquote type="cite" class=""><span class=""><div class="">On Dec 4, 2015, at 2:33 PM, Colin Cornaby &lt;<a class="">colin.cornaby@mac.com</a>&gt; wrote:</div><br class=""></span><div class=""><div class=""><span class=""><div class="">I was talking with people in the office about this proposal today, in since there has been such a long discussion already I'll just reply to the top of the tree just to get our take in before the review...</div><div class=""><br class=""></div><div class="">It's understood that Swift has better, more readable ways to do for loops, but C style for loops reduce friction for getting our C or C++ developers on board with Swift. Unless there is a gain elsewhere to be made in their removal, it would be nice to keep them. As we transition to Swift we can educate developers on better ways to iterate, but it would be nice to have one less thing in the way of getting people writing Swift code.</div><div class=""><br class=""></div><div class="">We work on a lot of algorithmic code which would be well suited for Swift. And again, I understand that C style for loops are redundant. But it's just one less speed bump in understanding for some of our developers or for porting pure C or C++ code without having to do as much re-validation of algorithms for accidental changes.</div><div class=""><br class=""></div><div class="">But if it's actively hurting some other part of the language we could probably be talked into it.</div><div class=""><br class="">On Dec 03, 2015, at 03:32 PM, Erica Sadun &lt;<a class="">erica@ericasadun.com</a>&gt; wrote:<br class=""><br class=""></div></span><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word;"><span class="">Does Swift still needs C-style for loops with conditions and incrementers?&nbsp;<div class=""><br class=""></div></span><div class=""><span class=""><div class=""><span class="">&lt;Screen Shot 2015-12-03 at 4.30.15 PM.png&gt;</span></div><div class=""><br class=""></div></span><span class=""><div class="">More Swift-like construction is already available with<span class="Apple-converted-space">&nbsp;</span><i class="">for-in</i>-statements and<span class="Apple-converted-space">&nbsp;</span><i class="">stride</i>.&nbsp;</div><div class="">This would naturally starve the most common point for -- and ++ operators as well.</div></span></div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div><img alt="" height="1" border="0" width="1" class="" style="min-height: 1px; width: 1px; border-width: 0px; padding: 0px; margin: 0px;"></div></blockquote></div><img alt="" height="1" border="0" width="1" class="" style="min-height: 1px; width: 1px; border-width: 0px; padding: 0px; margin: 0px;"></div><span class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a class=""></a><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a class=""></a><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></span></div></blockquote></div><br class=""><img alt="" height="1" border="0" width="1" class="" style="min-height: 1px; width: 1px; border-width: 0px; padding: 0px; margin: 0px;"></div><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a class=""></a><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a rel="noreferrer" class=""></a><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class=""></blockquote></div><br class=""></div></div></blockquote></div><img alt="" height="1" border="0" width="1" class="" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a class=""></a><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a class=""></a><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote><img alt="" height="1" border="0" width="1" class="" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a class=""></a><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a class=""></a><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote><img alt="" height="1" border="0" width="1" class="" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></blockquote></div></div></div></blockquote></div></div></div></blockquote></div><br class=""></body></html>