<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="">Goedemorgen David, Chris &amp; Other respected,</div><div class=""><br class=""></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; for v from v1 to v2 by v3 { }</div></div><div class=""><br class=""></div><div class="">Yes, i do see this for variant as an *additional* alternative to ranges/strides.</div><div class=""><br class=""></div><div class="">Regarding performance, I was under the false impression that for a stride</div><div class="">a complete collection was generated, but luckily this is not the case, as for each</div><div class="">next() a new value is calculated, not a collection element is returned</div><div class=""><br class=""></div><div class="">In the mean time I’ve made a new Strider variant, as described in detail</div><div class="">with source code in another post I’ve submitted yesterday:</div><div class=""><br class=""></div><div class=""><span style="font-family: Menlo; font-size: 16px; color: rgb(79, 129, 135);" class="">for v in Strider</span><span style="font-family: Menlo; font-size: 16px;" class="">( from: v1</span><span style="font-family: Menlo; font-size: 16px;" class="">, to: v2, by: v3, tolerance: vtol)&nbsp;</span><span style="font-family: Menlo; font-size: 16px;" class="">{ Aragorn(v) }</span></div><div class=""><br class=""></div><div class="">which is also implemented (as the other stride(s) as a Double extension function.</div><div class="">Also able to move backwards.&nbsp;</div><div class=""><br class=""></div><div class="">In essence, I can live with using a strider construct, because it can do everything</div><div class="">the classical ‘for ; ;’ &nbsp;loop does. &nbsp;</div><div class="">(although the classical for-loop is way much more efficient) &nbsp;</div><div class=""><br class=""></div><div class="">And also working with pseudo-collections as Strides are has advantages as well</div><div class=""><br class=""></div><div class="">(still:&nbsp;</div><div class="">Laying under my car and trying with one hand to find</div><div class="">my for-screwdriver. "Sh..! Hey! Who took my really handy wrench&nbsp;</div><div class="">out of my shiny new Swift toolbox !?! Because he/she thought</div><div class="">wrongly I didn’t need it anymore? And also without offering a better alternative?” )</div><div class="">&nbsp;</div><div class="">&nbsp;</div><div class="">I still think its an important Swift improvement to also have:</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp; for v from v1 to v2 by v3 { }</div><div class=""><br class=""></div><div class="">and perhaps add for real numbers, this tolerance parameter like so:</div><div class=""><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp; for v from v1 to v2 by v3 tolerance vtol { }’</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Not only because it is easier to think and write,</div><div class="">especially for those new to Swift,</div><div class=""><br class=""></div><div class="">@Chris: &nbsp; !</div><div class="">but also because the Swift compiler can really boil this</div><div class="">down to a very efficient loop structure wit nearly no calls involved.</div><div class="">instead of having to get values from a generator all the time.</div><div class=""><br class=""></div><div class="">I’d estimate this would at least save about 10 calls or so,</div><div class="">but I am not sure of that, as I have no experience</div><div class="">with working on compilers, parsers and the like.</div><div class=""><br class=""></div><div class="">I assume that our compiler is not intelligent enough to</div><div class="">optimize this strider logic away, because it simply cannot know</div><div class="">in advance what values to expect from the strider sequence.</div><div class=""><br class=""></div><div class="">I do also still think the compiler should treat tolerance requests</div><div class="">for the same reason of a significant performance improvement.</div><div class="">(As in a previous thread I’ll pick up again)&nbsp;</div><div class=""><br class=""></div><div class="">About reserved words: &nbsp;(will also post this separate)&nbsp;</div><div class="">In short:</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-= &nbsp;there should be none =-</div><div class="">A compiler should have enough intelligence to determine</div><div class="">from the statement’s context if a word is used as a keyword</div><div class="">or not. &nbsp; Like e.g. in PL/1 as I posted here before.&nbsp;</div><div class="">&nbsp; ----</div><div class="">Lunch break &nbsp;Going to get some coffee to get over</div><div class="">what I saw on BBC/CNN TV…&nbsp;</div><div class="">Some things are really hard to believe.</div><div class="">So, to my dear American colleagues and friends:</div><div class="">for _ in 1..100; { print(“Please! “}&nbsp;</div><div class="">don’t vote for someone like that.</div><div class="">It is already bad enough that he came that far.</div><div class=""><a href="https://www.youtube.com/watch?v=FK3TIYG9mqM" class="">https://www.youtube.com/watch?v=FK3TIYG9mqM</a></div><div class="">&nbsp; ----</div><div class=""><br class=""></div><div class="">kind regards / met vriendelijke groeten</div><div class="">TedvG</div><div class=""><br class=""></div><div class=""><div style="color: rgb(0, 0, 0); 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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); 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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; -webkit-text-stroke-width: 0px; word-spacing: 0px; white-space: normal; text-transform: none; letter-spacing: normal;" class=""><div style="color: rgb(0, 0, 0);" class=""><div style="color: rgb(0, 0, 0);" class=""><br class=""></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div><blockquote type="cite" class=""><div class="">On 26.02.2016, at 21:52, David Waite &lt;<a href="mailto:david@alkaline-solutions.com" class="">david@alkaline-solutions.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Feb 26, 2016, at 9:07 AM, Ted F.A. van Gaalen via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""> Does .stride(), which in the end uses a descendant of SequenceType, just calculate a new value each time &nbsp;&nbsp;for..in.. &nbsp;&nbsp;uses .next() on this collection? <br class=""></blockquote></blockquote></blockquote><br class="">this.<br class=""><br class=""><blockquote type="cite" class=""> &nbsp;&nbsp;&nbsp;for &nbsp;x from xmin to xmax by xstep &nbsp;{ }<br class=""><br class=""> &nbsp;&nbsp;&nbsp;for x from xmax to xmin by -xstep &nbsp;{ } <br class=""><br class=""> &nbsp;&nbsp;&nbsp;for apple from 1 to applesInTruck &nbsp;{ }<br class=""><br class="">No need for collections in these cases,<br class=""></blockquote><br class="">As the thread for removal of C-style for showed in benchmarks, using a range or stride does not have a performance impact under optimization. Such new syntax would need to stand on its own as a second alternative to using ranges/strides. <br class=""><br class="">Considering that it would require reserving three new keywords (‘from’, ‘to’, and ‘by’) this will be a hard argument to make.<br class=""><br class="">-DW<br class=""><br class=""></div></div></blockquote></div><br class=""></body></html>