<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 10, 2016 at 6:02 PM, Tyler Cloutier <span dir="ltr"><<a href="mailto:cloutiertyler@aol.com" target="_blank">cloutiertyler@aol.com</a>></span> wrote:<br><div><br></div><div>Let me be explicit about how the two ideas compare. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div class="h5"><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote"><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 style="word-wrap:break-word"><div><div></div><div>I’d also like to point out Chris’ comments on the </div><div><br></div><div>repeat X {</div><div><br></div><div>}</div><div><br></div><div>discussion.</div><div><br></div><div>“</div><div><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)">This is a very valid use case.
FWIW, “repeat N {}” was originally designed and scoped into the Swift 2 implementation of the feature, but was cut due to schedule limitations. There is precedent for this sort of feature in many teaching oriented languages (e.g. Logo).
I’d say that the pro’s and con’s of this are:
+ Makes a simple case very simple, particularly important in teaching.</pre></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote><div><br></div><div>Repeating N times is a simple case, and `repeat N { }` makes it simple. Repeating an indefinite number of times is not really a simple case--at least, it's not the same case--and it's not even profitably usable until a beginner has mastered another concept, namely `break`.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div class="h5"><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote"><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 style="word-wrap:break-word"><div><div><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)">+ Even if you aren’t familiar with it, you can tell at first glance what the behavior is.</pre></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote><div><br></div><div>As I've mentioned above and Cole has just reinforced, with this proposal, you can't tell at first glance what the behavior of `repeat {` is until you read the end brace--even if you *are* familiar with it. By contrast, `repeat N { }` is immediately understood, whether or not you're familiar with it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div class="h5"><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote"><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 style="word-wrap:break-word"><div><div><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)">- It is “just syntactic sugar”, which makes the language more complex.</pre></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote><div><br></div><div>Whether you naively compare letters saved or concepts invoked, `repeat N { }` is very sweet sugar in comparison to `for _ in 0..<N { }`, but `repeat { }` is not very sweet sugar in comparison to `while true { }`.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div class="h5"><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote"><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 style="word-wrap:break-word"><div><div><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)">- It is a very narrow feature that is useful in few practical situations.</pre></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote><div><br></div><div>Here, `repeat N { }` can be used for any value N, but `repeat { }` is useful only for saving four letters from `while true { }`.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div class="h5"><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote"><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 style="word-wrap:break-word"><div><div><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)">
-Chris</pre><div>“</div><div><br></div><div>In this case, I would say it’s not making the language any more complex given that repeat-while is a current construct. Admittedly it is a very narrow feature, but it’s also a small one.</div></div></div></div></blockquote><div><br></div><div>For the reasons I outlined above, I'd be +1 for `repeat N` and -1 for this case.</div><div><br></div></div></div></div></div></blockquote><div><br></div></div></div><div>That’s fair enough. :)</div><div><br></div><div>But surely you’ll admit that if </div><div><br></div><div>repeat N {</div><div><br></div><div>}</div><div><br></div><div>was valid, then repeat { } follows as the logical repeat indefinitely syntax, no?</div></div></div></blockquote></div></div></div>