<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Good catch. I think this functionality is worth adding. Seems like it could be useful for e.g., a grid of buttons.</div><div><br>On Aug 17, 2017, at 11:25 AM, Rob Mayoff via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 17, 2017 at 7:04 AM, Robert Bennett via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div></div><div>Alternatively, instead of replacing the current definition with an autoclosure version, we could leave the current version in place and add a version taking a function. This could be especially useful when you’ve defined a function like `makeMySpecialKindOfButton() -> UIButton` that does a lot of customization to an object before returning it.</div><div><br></div><div>Array(repeating: { return UIView() }, count: 3)</div><div>and</div><div>Array(repeating: <span style="background-color:rgba(255,255,255,0)">makeMySpecialKindOfButton, count: 3)</span></div></div></blockquote><div><br></div><div>This is still source-breaking, because an array of closures is legal. We need a different name to avoid breaking source:</div><div><br></div><div> Array(repeatedlyCalling: { UIView() }, count: 3)</div><div> </div></div></div></div>
</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>