<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
</head>
<body><div style="font-family:Arial;">I'm not sure a valid use case by a third party makes it hold its weight for inclusion in the stdlib. Reproducing its feature set is extremely trivial, and would probably allow you to hint the implementation details better for your use case.<br></div>
<div style="font-family:Arial;"><br></div>
<div id="sig20055365"><div class="signature"><span class="font" style="font-family:arial, sans-serif, sans-serif">Zach</span><span class="font" style="font-family:arial, sans-serif, sans-serif"></span><br></div>
<div class="signature"><a href="mailto:zach@waldowski.me"><span class="font" style="font-family:arial, sans-serif, sans-serif">zach@waldowski.me</span></a><span class="font" style="font-family:arial, sans-serif, sans-serif"></span><br></div>
<div class="signature"><br></div>
<div style="font-family:Arial;"><br></div>
</div>
<div>On Tue, Jan 9, 2018, at 2:12 AM, Gwendal Roué via swift-evolution wrote:<br></div>
<blockquote type="cite"><div style="font-family:Arial;"><br></div>
<div><blockquote type="cite"><div>Le 9 janv. 2018 à 08:06, Gwendal Roué via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; a écrit :<br></div>
<div style="font-family:Arial;"><br></div>
<div><div style="word-wrap:break-word;line-break:after-white-space;"><div style="font-family:Arial;"><br></div>
<div><blockquote type="cite"><div>Le 9 janv. 2018 à 06:40, Nevin Brackett-Rozinsky via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; a écrit :<br></div>
<div style="font-family:Arial;"><br></div>
<div><div dir="ltr"><div><div defang_data-gmailquote="yes"><div>The ulterior question of whether preserving “DictionaryLiteral”&nbsp;is worthwhile, is apparently out of scope. Personally, I have a hard time imagining a compelling use-case outside of the standard library, and I doubt it’s being used “in the wild” (I checked several projects in the source-compatibility suite and found zero occurrences).<br></div>
</div>
</div>
</div>
</div>
</blockquote><div style="font-family:Arial;"><br></div>
</div>
<div>DictionaryLiteral is worthwhile. The SQLite library GRDB uses DictionaryLiteral in order to build database rows (which may have duplicated column names, and whose column ordering is important). This is mostly useful for tests:<br></div>
<div><br></div>
<div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:12px;line-height:normal;font-family:Menlo;background-color:rgb(255, 255, 255);">&nbsp; &nbsp;&nbsp;<span class="colour" style="color:rgb(186, 45, 162)">let</span> row = <span class="colour" style="color:rgb(186, 45, 162)">try</span> Row.fetchOne(db, <span class="colour" style="color:rgb(209, 47, 27)">"SELECT 1 AS a, 2 AS a"</span>)!<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:12px;line-height:normal;font-family:Menlo;background-color:rgb(255, 255, 255);">&nbsp; &nbsp; XCTAssertEqual(row, [<span class="colour" style="color:rgb(209, 47, 27)">"a"</span>: <span class="colour" style="color:rgb(39, 42, 216)">1</span>, <span class="colour" style="color:rgb(209, 47, 27)">"a"</span>: <span class="colour" style="color:rgb(39, 42, 216)">2</span>])<br></div>
<div><br></div>
</div>
<div style="font-family:Arial;">Gwendal<br></div>
</div>
</div>
</blockquote><div style="font-family:Arial;"><br></div>
</div>
<div>Chris Lattner's wrote:<br></div>
<div><br></div>
<div><div style="font-family:SFUIDisplay-Regular;"><blockquote type="cite">why is maintaining duplicate keys a feature?<br></blockquote></div>
<div><blockquote type="cite"><span class="font" style="font-family:SFUIDisplay-Regular">Since it is immutable, why not sort the keys in the initializer, allowing an efficient binary search to look up values?</span><br></blockquote></div>
</div>
<div style="font-family:Arial;"><br></div>
<div>I really wish both duplicated keys and key ordering would be preserved, since both are needed for the above sample code.<br></div>
<div><br></div>
<div>Should those features be lost, the sky wouldn't fall, that's sure. But we'd have to write something much less easy to wrote and read:<br></div>
<div><br></div>
<div><span style="white-space:pre;"></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">XCTAssertEqual(row.map { $0 }, [(</span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="colour" style="color:rgb(209, 47, 27)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">"a"</span></span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">,</span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">&nbsp;</span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="colour" style="color:rgb(39, 42, 216)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">1)</span></span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">,</span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">&nbsp;(</span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="colour" style="color:rgb(209, 47, 27)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">"a"</span></span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">,</span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">&nbsp;</span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="colour" style="color:rgb(39, 42, 216)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">2)</span></span></span></span><span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="font" style="font-family:Menlo"><span class="size" style="font-size:12px">])</span></span></span><br></div>
<div><br></div>
<div>Gwendal<br></div>
<div><br></div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div style="font-family:Arial;"><br></div>
</body>
</html>