<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>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><br></div><div>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><br></div><div>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. </div><div><br></div><div>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><br></div><div>Perhaps some while loop syntax like:</div><div><br></div><div>while (x < someThing) start var x = 0, y = 11 {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>x += someOtherThing</div><div>}</div><div><br></div><div>Which is decidedly terrible syntax, but that's kind of the idea anyway.</div><div><br></div><div>Tyler</div><div><br></div><div><br><br><div><div><br></div></div></div><div><br>On Dec 4, 2015, at 3:21 PM, Colin Cornaby <<a href="mailto:colin.cornaby@mac.com">colin.cornaby@mac.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div>This is a nice solution that translates nicely without creating too much concern about changing the nature of an algorithm in a complex system. đź‘Ť<br></div><div><br data-mce-bogus="1"></div><div>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><br>On Dec 04, 2015, at 02:52 PM, Johan Jensen <<a href="mailto:jj@johanjensen.dk">jj@johanjensen.dk</a>> wrote:<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div dir="ltr"><div><div>With the removal of post/pre-increment/decrement you might as well translate C-style for-loops to something akin to<br><br></div>for var i in 0..<10 {<br> ...<br>}<br><br></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. <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 4, 2015 at 11:37 PM, Joe Groff <span dir="ltr"><<a href="mailto:jgroff@apple.com" data-mce-href="mailto:jgroff@apple.com">jgroff@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0 0 0 0.8ex; border-left: 1px #ccc solid; padding-left: 1ex;" data-mce-style="margin: 0 0 0 0.8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div style="word-wrap: break-word;" data-mce-style="word-wrap: break-word;"><div>You might ease the pain by approximating C-style 'for' by a higher-order function:</div><div><br></div><div>func cStyleFor(@autoclosure init initializer: () -> (), @autoclosure test: () -> Bool, @autoclosure inc: () -> (), body: () throws -> ()) rethrows {</div><div> // left as an exercise</div><div>}</div><div><br></div><div>var i = 0</div><div>cStyleFor(init: i = 0, test: i < 10, inc: ++i) {</div><div> print(i)</div><div>}</div><div><br></div><div>-Joe</div><br><div><blockquote type="cite"><span class=""><div>On Dec 4, 2015, at 2:33 PM, Colin Cornaby <<a href="mailto:colin.cornaby@mac.com" data-mce-href="mailto:colin.cornaby@mac.com">colin.cornaby@mac.com</a>> wrote:</div><br></span><div><div><span class=""><div>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><br></div><div>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><br></div><div>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><br></div><div>But if it's actively hurting some other part of the language we could probably be talked into it.</div><div><br>On Dec 03, 2015, at 03:32 PM, Erica Sadun <<a href="mailto:erica@ericasadun.com" data-mce-href="mailto:erica@ericasadun.com">erica@ericasadun.com</a>> wrote:<br><br></div></span><div><blockquote type="cite"><div style="word-wrap: break-word;" data-mce-style="word-wrap: break-word;"><span class="">Does Swift still needs C-style for loops with conditions and incrementers? <div><br></div></span><div><span class=""><div><span><Screen Shot 2015-12-03 at 4.30.15 PM.png></span></div><div><br></div></span><span class=""><div>More Swift-like construction is already available with <i>for-in</i>-statements and <i>stride</i>. </div><div>This would naturally starve the most common point for -- and ++ operators as well.</div></span></div><div><br></div><div>-- E</div><div><br></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=OFgvmg1J6naJevMotmPmRgzA4p1gcL5s2O89Xj3c0DQwWaI2Zkn0T7Ir0ZhZX5JxhOGd3YPVKqo7V694c-2FCbs4q0bD0JoSqDmVKJlXSPFXuXDd-2BrSCkHJtpH2xW9FNCpsnXhG1CXNS-2BYiwa2avrMmz1klqK9v719yPdWuKsBJaZWK1jLmeFzO0xSa2YmruaZcuht7m9Jfq3dmNJI2I0f-2FXBDGxRbOsbfv3np8d7UbdU-3D" alt="" style="min-height: 1px; width: 1px; border-width: 0; padding: 0; margin: 0;" height="1" border="0" width="1" data-mce-src="https://u2002410.ct.sendgrid.net/wf/open?upn=OFgvmg1J6naJevMotmPmRgzA4p1gcL5s2O89Xj3c0DQwWaI2Zkn0T7Ir0ZhZX5JxhOGd3YPVKqo7V694c-2FCbs4q0bD0JoSqDmVKJlXSPFXuXDd-2BrSCkHJtpH2xW9FNCpsnXhG1CXNS-2BYiwa2avrMmz1klqK9v719yPdWuKsBJaZWK1jLmeFzO0xSa2YmruaZcuht7m9Jfq3dmNJI2I0f-2FXBDGxRbOsbfv3np8d7UbdU-3D" data-mce-style="min-height: 1px; width: 1px; border-width: 0; padding: 0; margin: 0;"></div></blockquote></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=RoDF4MveSEMYBIqIJA6ub1g8cOZ-2BVYvqV-2FqygPhjPn9dSCJq6hHxaKAHz2SgEMUEdmJq-2FsAifCMjI5P2wUJabdikvDGXS5zaIeiAW9VmUaiGFnyIyDQg2eHpiypFZpLqkwlMcSPttbgMOFlDhKsq7OZYMo2NC9kSDKFKCrEgV5UwEzHq3kVy3cvCkNDjAtbKUGaHHbyeqN4xiVXzGIrvZWzJxd5zQxuKao7pxdgeN1w-3D" alt="" style="min-height: 1px; width: 1px; border-width: 0; padding: 0; margin: 0;" height="1" border="0" width="1" data-mce-src="https://u2002410.ct.sendgrid.net/wf/open?upn=RoDF4MveSEMYBIqIJA6ub1g8cOZ-2BVYvqV-2FqygPhjPn9dSCJq6hHxaKAHz2SgEMUEdmJq-2FsAifCMjI5P2wUJabdikvDGXS5zaIeiAW9VmUaiGFnyIyDQg2eHpiypFZpLqkwlMcSPttbgMOFlDhKsq7OZYMo2NC9kSDKFKCrEgV5UwEzHq3kVy3cvCkNDjAtbKUGaHHbyeqN4xiVXzGIrvZWzJxd5zQxuKao7pxdgeN1w-3D" data-mce-style="min-height: 1px; width: 1px; border-width: 0; padding: 0; margin: 0;"></div><span class=""> _______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" data-mce-href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" data-mce-href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></div></blockquote></div><br> <img src="https://u2002410.ct.sendgrid.net/wf/open?upn=KlmFWKNIEcyPEGx2Wqruu-2FaM6I0anrxIOlKS1pgqec64JmPD57SelWBf8STiBYuH5i3ko-2FtD2CU6chZgK79T9K3b3jBmmA5gMpTX5FF5mQnohQWqc0wkDTtpj-2FuZjbkeuGjx9YAUCDfU8j39LzH9ARiDcAzF3Bn8yEUzw1iLutsMLA-2FFkrnHXyH-2FxtuuASWC4iWLDeixQLwaQDsRNIRipB5PAbcL-2ByGZDjYiIwDQNRc-3D" alt="" style="min-height: 1px; width: 1px; border-width: 0; padding: 0; margin: 0;" height="1" border="0" width="1" data-mce-src="https://u2002410.ct.sendgrid.net/wf/open?upn=KlmFWKNIEcyPEGx2Wqruu-2FaM6I0anrxIOlKS1pgqec64JmPD57SelWBf8STiBYuH5i3ko-2FtD2CU6chZgK79T9K3b3jBmmA5gMpTX5FF5mQnohQWqc0wkDTtpj-2FuZjbkeuGjx9YAUCDfU8j39LzH9ARiDcAzF3Bn8yEUzw1iLutsMLA-2FFkrnHXyH-2FxtuuASWC4iWLDeixQLwaQDsRNIRipB5PAbcL-2ByGZDjYiIwDQNRc-3D" data-mce-style="min-height: 1px; width: 1px; border-width: 0; padding: 0; margin: 0;"></div><br>_______________________________________________<br> swift-evolution mailing list<br> <a href="mailto:swift-evolution@swift.org" data-mce-href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" data-mce-href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br> <br></blockquote></div><br></div></div></blockquote></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=DOmV4Qxg-2B1XOnX4CfTyH3sCllXs7myBcgXMCpdkqNW1a79daImdLJ6B-2B2UWsc8ff-2FfFW7ysfaaKzxcPu9d-2BR67VhaBL6AVYp2B-2FTWWfTotjskj4pm6r-2BLiG-2BkSaXUqWKhEx3kpzVwewUucp0OomhzMgZO5hdcMLXDwe2e2v9-2BQfbHYvjaugUHo4BUTLBjo0REQmBPaAxAnK3EnNUHu5ZzGpjin9ZN5YW9ydX4qlW2f0-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;">
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>