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.
Zach
z...@waldowski.me


On Tue, Jan 9, 2018, at 2:12 AM, Gwendal Roué via swift-evolution wrote:> 
>> Le 9 janv. 2018 à 08:06, Gwendal Roué via swift-evolution <swift-
>> evolut...@swift.org> a écrit :>> 
>> 
>>> Le 9 janv. 2018 à 06:40, Nevin Brackett-Rozinsky via swift-evolution
>>> <swift-evolution@swift.org> a écrit :>>> 
>>> The ulterior question of whether preserving “DictionaryLiteral” 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).>> 
>> 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:>> 
>>     let row = try Row.fetchOne(db, "SELECT 1 AS a, 2 AS a")!
>>     XCTAssertEqual(row, ["a": 1, "a": 2])
>> 
>> Gwendal
> 
> Chris Lattner's wrote:
> 
>> why is maintaining duplicate keys a feature?
>> Since it is immutable, why not sort the keys in the initializer,
>> allowing an efficient binary search to look up values?> 
> I really wish both duplicated keys and key ordering would be
> preserved, since both are needed for the above sample code.> 
> 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:> 
> XCTAssertEqual(row.map { $0 }, [("a", 1), ("a", 2)])
> 
> Gwendal
> 
> _________________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to