<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>What about the mathematical Set notation?:</div><div><br></div><div>let numbers = {3, 1, 4, 1, 5, 9, 2, 6, 5, 3}</div><div><br></div><div>But this is highly ambiguous in those cases:</div><div><span style="background-color: rgba(255, 255, 255, 0);">let numbers = {} // closure ()->()</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">let numbers = {3} // closure ()->Int</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">So a type annotation is still needed at least for empty Sets and single element ones. There could be also some difficulties while parsing the swift file.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div>As some others have said I'm not sure whether such additional syntax pays off.</div><div><br></div><div>- Maximilian</div><div><br>Am 19.01.2016 um 23:00 schrieb T.J. Usiyan via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>:<br><br></div><blockquote type="cite"><div><div dir="ltr">I agree that the probably isn't a better story for literals and Sets and that I wish that there were a better story.<div><br></div><div>The best that I can think of is some sort of flag outside of the Array literal, for instance, #["A", "B", "C"] or just using keys that people aren't already accustomed to like option-'\' and option-shift-'\'. «"A", "B", "C"]»</div><div><br></div><div><br></div><div>TJ</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 19, 2016 at 4:55 PM, Greg Parker 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 style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Jan 18, 2016, at 2:55 PM, Howard Lovatt via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><div><br><blockquote type="cite">On Tuesday, 19 January 2016, Jack Lawrence <<a href="mailto:jackl@apple.com" target="_blank">jackl@apple.com</a>> wrote:</blockquote></div></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></span><span class=""><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">On Jan 18, 2016, at 2:50 PM, Liam Butler-Lawrence via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Set("a", "b", "c”) doesn’t compile. It currently has to be Set(arrayLiteral: "a", "b", "c”). That said, I’d be satisfied with removing the external parameter name “arrayLiteral”. Not only is it unnecessary, but it’s confusing too: variadic parameters are not the same as an Array.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></span><span class=""><blockquote type="cite"><div><blockquote type="cite">init(arrayLiteral:) is there to satisfy ArrayLiteralConvertible. Set([“a”, “b”, “c”]) works just fine.</blockquote></div></blockquote><blockquote type="cite"><br></blockquote></span></div><span class=""><div><blockquote type="cite">Sure, but you could add another overload without the label.<br></blockquote></div><div><br></div></span>Only if you break existing code. Consider this expression:<div><br></div><div> Set(["a", "b"])</div><div><br></div><div>Is this</div><div>1. a Set<String> with two elements "a" and "b"</div><div>2. a Set<Array<String>> with one element ["a", "b"]</div><div><br></div><div>Currently it means #1. You could change it to mean #2, but that breaks existing code that expects #1. You could try to overload the no-name initializer, but that will be confusing to humans in some cases.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div>-- </div><div>Greg Parker <a href="mailto:gparker@apple.com" target="_blank">gparker@apple.com</a> Runtime Wrangler</div><div><br></div><div><br></div></font></span></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></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>