<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="">Hi Vladimir,</div><div class=""><br class=""></div><div class="">In the past weeks, I wrote extensively on swift-evolution&nbsp;</div><div class="">about an alternative for the classical for-loop.&nbsp;</div><div class="">So extensively that it irritated the ”Collectians”&nbsp;</div><div class="">who (indirectly) classified me and some similar others</div><div class="">as “Forloopians” and also “Traditionalists”…&nbsp;</div><div class="">I consider this as a great honor. :o)</div><div class=""><br class=""></div><div class="">Anyway, among other alternatives, I wrote this on April 5th.2016:</div><div class=""><br class=""></div><div class=""><div class=""></div><blockquote type="cite" class=""><div class="">So, to me the best option is still to bring the for ;; back</div><div class="">or to make a new Swift equivalent for it as described here again.</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">for</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;d&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">from</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">10.0&nbsp;</span><span class="" style="color: rgb(187, 44, 162);">to&nbsp;</span><span class="" style="color: rgb(39, 42, 216);">5.0&nbsp;</span><span class="" style="color: rgb(187, 44, 162);">by&nbsp;</span><span class="" style="color: rgb(39, 42, 216);">-0.1</span><span class="" style="color: rgb(187, 44, 162);">&nbsp;</span><span class="" style="color: rgb(187, 44, 162);">tolerance&nbsp;</span><span class="" style="color: rgb(39, 42, 216);">0.01 &nbsp;//tolerance is optional</span></div><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;">{</div><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp;&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);">print</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(d)</span></div><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div></div></blockquote><div class=""><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;"><br class=""></div></div></div><div class="">&nbsp; &nbsp; &nbsp;for v from v1 to v2 by vstep &nbsp; &nbsp; &nbsp; // it can’t be any simpler than this.&nbsp;</div><div class=""><br class=""></div><div class="">Of course, working with ALL existing numerical types, Int, Float, Double..&nbsp;</div><div class="">( Btw. me wishing: consolidate all floating point types into just one type, preferably Double!)</div><div class=""><br class=""></div><div class="">Apart from the “tolerance” &nbsp;option, which I intended for float boundaries in for-loops,&nbsp;</div><div class="">this is not my really original idea, because the traditional for-loop exist</div><div class="">more or less like this in most program languages for decades.&nbsp;</div><div class=""><br class=""></div><div class="">What do you think about my suggested for-loop?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I don’t like this variant at all:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><span style="font-size: 14.25px;" class="">for i in (1...10).striding(by: 3) {..}</span><br style="font-size: 14.25px;" class=""><span style="font-size: 14.25px;" class="">for i in (1...10).striding(by: -3) {..}</span><br style="font-size: 14.25px;" class=""></blockquote><br class="">It is downright ugly, cumbersome to write,&nbsp;</div><div class="">hard to read and also functionally very limited: &nbsp; &nbsp; **&nbsp;</div><div class="">- ranges like (10…-5) &nbsp;are not allowed</div><div class="">- ranges / for..in.. &nbsp;with other numerical types like Float and Double are not possible!</div><div class="">- I am still doubtful about optimization:&nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;the compiler always has to look what is behind the “in”</div><div class=""><br class=""></div><div class="">Ergo: There is still no good alternative for the classical for ;; &nbsp;that was in Swift.</div><div class=""><br class=""></div><div class="">One has to use “while {...}” loops.&nbsp;</div><div class="">which means specifying an iteration in 3 lines more and a bigger change</div><div class="">for errors.&nbsp;</div><div class=""><br class=""></div><div class="">&nbsp;<br class=""><blockquote type="cite" class=""><span style="font-size: 14.25px;" class="">But.. compare how the next is more clear and nice looking, has less noise,&nbsp;</span><br style="font-size: 14.25px;" class=""><span style="font-size: 14.25px;" class="">how faster this will be typed.. :</span><br style="font-size: 14.25px;" class=""><br style="font-size: 14.25px;" class=""><span style="font-size: 14.25px;" class="">for i in 1...10 by 3 {...}</span><br style="font-size: 14.25px;" class=""><span style="font-size: 14.25px;" class="">for i in 1...10 by -3 {</span>…<span style="font-size: 14.25px;" class="">}</span><br style="font-size: 14.25px;" class=""></blockquote><div class=""><br class=""></div><div class="">This looks better, indeed,</div><div class="">but still has the same severe limitations **</div><div class=""><br class=""></div><div class=""><br class=""></div><blockquote type="cite" class=""><span style="font-size: 14.25px;" class="">My opinion: this .striding is about Range type. Range type is used in many&nbsp;</span><br style="font-size: 14.25px;" class=""><span style="font-size: 14.25px;" class="">places, not just in for-in loop. It is important to have handy and clear&nbsp;</span><br style="font-size: 14.25px;" class=""><span style="font-size: 14.25px;" class="">methods for Range. But. If we are talking about loop - why(why?) can't we&nbsp;</span><br style="font-size: 14.25px;" class=""><span style="font-size: 14.25px;" class="">have such a great syntax for such a common loop task?&nbsp;</span><br style="font-size: 14.25px;" class=""></blockquote><div class="">That is my honest opinion too.</div><div class=""><br class=""></div><div class="">&nbsp;The only ambition of the for-loop I presented is for it&nbsp;</div><div class="">&nbsp;to be a convenience construct for the “while” loop &nbsp;</div><div class="">which it has always been. it is actually the sole</div><div class="">reason why it was invented in the first place.</div><div class=""><br class=""></div><div class="">There is nothing to be ashamed of to bring back&nbsp;</div><div class="">the for ;; . I am very serious here.</div><div class=""><br class=""></div><div class="">It is (was) one of the most powerful control statements in Swift!</div><div class=""><br class=""></div><div class="">IMHO it amazes me that people go through so much&nbsp;</div><div class="">unnecessary effort in an attempt to replace / circumvent</div><div class="">a nearly perfect iteration statement.&nbsp;</div><div class=""><br class=""></div><div class="">But I wrote about all this already too many times.</div><div class=""><br class=""></div><div class="">Please note that I do also see many good things and developments in Swift!</div><div class=""><br class=""></div><div class="">met vriendelijke groeten</div><div class=""><br class=""></div><div class="">TedvG&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><br class=""></div><div class=""><br class=""></div></body></html>