<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">How about renaming DictionaryLiteral to Row, TabularRow or TableRow?</div><div class=""><br class=""></div><div class="">I think most developers are familiar with the idea that a table row contains multiple columns (in specific order), and each column has a name and a value (key/value).</div><div class=""><br class=""></div><div class="">Some other name suggestions:</div><div class="">- Record (kind of an old name for table rows)</div><div class="">- SortedDictionary (sorted dictionaries are missing on the standard library, and could give a chance to make this type more widely used)</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Eneko&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 9, 2018, at 9:19 AM, Nate Cook via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class="">On Jan 9, 2018, at 11:00 AM, Gwendal Roué via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">Le 9 janv. 2018 à 17:16, Zach Waldowski via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; 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.</div></div></blockquote><div class=""><br class=""></div><div class="">You're definitely right, and that's why I wrote with the most humble tone I could.</div><div class=""><br class=""></div><div class="">Yet, the design of the stdlib *requires* some speculation about use cases, and speculation is *helped* by the exposition of actual uses. I'm not sure readers of the mailing list had any idea of the use cases of the current DictionaryLiteral, and maybe I helped a little.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: Arial;">Reproducing its feature set is extremely trivial, and would probably allow you to hint the implementation details better for your use case.<br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">Please define "trivial”.</div></div></div></blockquote><div class=""><blockquote type="cite" class=""><br class=""></blockquote></div><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">In case anybody would wonder, in the line below the `row` variable is of type Row which happens to adopt ExpressibleByDictionaryLiteral. It is not of type DictionaryLiteral. The use case here is the ability to express a row with a dictionary literal that accepts duplicated keys and preserves ordering:</div><div class=""><br class=""></div><div class=""><div class=""><div class=""><div class="" style="word-wrap: break-word;"><div class=""><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCTAssertEqual(row, [<span class="colour" style="color: rgb(209, 47, 27);">"a"</span>:&nbsp;<span class="colour" style="color: rgb(39, 42, 216);">1</span>,&nbsp;<span class="colour" style="color: rgb(209, 47, 27);">"a"</span>:&nbsp;<span class="colour" style="color: rgb(39, 42, 216);">2</span>])</div></div></div></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">That’s great! In this case you aren’t using the DictionaryLiteral type, but a “dictionary literal”, which no one is suggesting we remove. If I’m understanding what you wrote, this is another case where the terrible name is making it super hard to discuss what we’re talking about. “Dictionary literals” and the ExpressibleByDictionaryLiteral protocol are safe!</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">I don't see how anything could better fit this use case than the current DictionaryLiteral. This is not *my* use case, but the use case of anyone that wants to model database rows beyond the traditional (and ill-advised) dictionary.</div><div class=""><br class=""></div><div class="">Some other users may come with other use cases that may also help the stdlib designers choose the best solution.</div><div class=""><br class=""></div><div class="">Gwendal</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: Arial;"><br class=""></div><div id="sig20055365" class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><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 class=""></div><div class="signature"><a href="mailto:zach@waldowski.me" class=""><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 class=""></div><div class="signature"><br class=""></div><div class="" style="font-family: Arial;"><br class=""></div></div><div class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, Jan 9, 2018, at 2:12 AM, Gwendal Roué via swift-evolution wrote:<br class=""></div><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="font-family: Arial;"><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">Le 9 janv. 2018 à 08:06, Gwendal Roué via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :<br class=""></div><div class="" style="font-family: Arial;"><br class=""></div><div class=""><div class="" style="word-wrap: break-word;"><div class="" style="font-family: Arial;"><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">Le 9 janv. 2018 à 06:40, Nevin Brackett-Rozinsky via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :<br class=""></div><div class="" style="font-family: Arial;"><br class=""></div><div class=""><div dir="ltr" class=""><div class=""><div defang_data-gmailquote="yes" class=""><div class="">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 class=""></div></div></div></div></div></blockquote><div class="" style="font-family: Arial;"><br class=""></div></div><div class="">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 class=""></div><div class=""><br class=""></div><div class=""><div class="" style="margin: 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><span class="Apple-converted-space">&nbsp;</span>row =<span class="Apple-converted-space">&nbsp;</span><span class="colour" style="color: rgb(186, 45, 162);">try</span><span class="Apple-converted-space">&nbsp;</span>Row.fetchOne(db,<span class="Apple-converted-space">&nbsp;</span><span class="colour" style="color: rgb(209, 47, 27);">"SELECT 1 AS a, 2 AS a"</span>)!<br class=""></div><div class="" style="margin: 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="Apple-converted-space">&nbsp;</span><span class="colour" style="color: rgb(39, 42, 216);">1</span>,<span class="Apple-converted-space">&nbsp;</span><span class="colour" style="color: rgb(209, 47, 27);">"a"</span>:<span class="Apple-converted-space">&nbsp;</span><span class="colour" style="color: rgb(39, 42, 216);">2</span>])<br class=""></div><div class=""><br class=""></div></div><div class="" style="font-family: Arial;">Gwendal<br class=""></div></div></div></blockquote><div class="" style="font-family: Arial;"><br class=""></div></div><div class="">Chris Lattner's wrote:<br class=""></div><div class=""><br class=""></div><div class=""><div class="" style="font-family: SFUIDisplay-Regular;"><blockquote type="cite" class="">why is maintaining duplicate keys a feature?<br class=""></blockquote></div><div class=""><blockquote type="cite" class=""><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 class=""></blockquote></div></div><div class="" style="font-family: Arial;"><br class=""></div><div class="">I really wish both duplicated keys and key ordering would be preserved, since both are needed for the above sample code.<br class=""></div><div class=""><br class=""></div><div class="">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 class=""></div><div class=""><br class=""></div><div class=""><span class="" 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 class=""></div><div class=""><br class=""></div><div class="">Gwendal<br class=""></div><div class=""><br class=""></div><div class=""><u class="">_______________________________________________</u><br class=""></div><div class="">swift-evolution mailing list<br class=""></div><div class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""></div><div 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 class="" style="font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: Arial;"><br class=""></div><span class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">_______________________________________________</span><br class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">swift-evolution mailing list</span><br class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><a href="mailto:swift-evolution@swift.org" class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">swift-evolution@swift.org</a><br class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">_______________________________________________</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">swift-evolution mailing list</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><a href="mailto:swift-evolution@swift.org" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">swift-evolution@swift.org</a><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>