<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 8, 2015, at 10:05 PM, André Videla <<a href="mailto:zephyz@me.com" class="">zephyz@me.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">How about having a default implementation in the standard library for it? </div><div class="">We avoid syntactic sugar and we allow for this very simple yet useful expression.</div><div class="">And we’ve seen solutions in this thread using autoclosurses and extensions</div><div class=""><br class=""></div><div class="">5.times {</div><div class=""> …</div><div class="">}</div></div></div></blockquote><div><br class=""></div>If the teaching angle is the motivation, then I’d say that this is worse. </div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">or a function</div><div class=""><br class=""></div><div class="">repeat(4) {</div><div class=""> …</div><div class="">}</div></div></div></blockquote><br class=""><div>Note that this *is* the proposal. :-) “repeat” is a keyword in swift.</div><div><br class=""></div><div>-Chris</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">all sound good to me.</div><div class=""><br class=""></div><div class="">- André</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 09 Dec 2015, at 06:58, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">On Dec 8, 2015, at 4:43 PM, Daniel Steinberg via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<div class=""><blockquote type="cite" class=""><div class=""><div 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;" class=""></div><div 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;" class="">For me this comes up when teaching children or new programmers. (Perhaps not a valid use case)</div></div></blockquote><div class=""><br class=""></div><div class="">This is a very valid use case.</div><div class=""><br class=""></div><div class="">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).</div><div class=""><br class=""></div><div class="">I’d say that the pro’s and con’s of this are:</div><div class=""><br class=""></div><div class="">+ Makes a simple case very simple, particularly important in teaching.</div><div class="">+ Even if you aren’t familiar with it, you can tell at first glance what the behavior is.</div><div class="">- It is “just syntactic sugar”, which makes the language more complex.</div><div class="">- It is a very narrow feature that is useful in few practical situations.</div><div class=""><br class=""></div><div class="">-Chris</div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=41N46VivWCZSszJfIBo5GmyHxjrOakJAcXHty8ZW-2FGhs8teaOUlcVyh8QnI9g7h0iDnLCWCVHmPKUk54l97lzseMpm3DSkV0swNaGZto3zxhnMCqLQO4eo92JbTfmmNB8XrsSs3G-2BE6Bhpo-2FZpKiHAXDZYkMyynnOU2qAQADCwtl8wEB8zy3IqigpG6fQdiX7kYktIL4GEZUVkI-2BmLE0cA-3D-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;" class="">
</div>
_______________________________________________<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><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></body></html>