[swift-evolution-announce] [Accepted] SE-165: Dictionary & Set Enhancements

Ben Cohen ben_cohen at apple.com
Thu Apr 20 09:55:31 CDT 2017

Hello Swift Community,

The review of SE-165: Dictionary & Set Enhancements ran from April 6...11, 2017. The proposal is accepted with some revisions regarding naming:

1) The key/value sequence of init that does not take a closure resolving key conflicts will be named init(uniqueKeysWithValues:). The core team felt that either possible implementation – a default way of coalescing keys, or fatalError-ing on conflicts – could be surprising to users in ways that could easily be missed in testing. A failable initializer would probably result in frequent force-unwrapping. Giving the initializer an argument label that clearly states the uniqueness requirement fulfills the goal of making sure the caller is aware of the requirement.

2) The initializer that takes a sequence of pairs and a closure for conflicts will be named init(_:uniquingKeysWith:), and the two merge methods (mutating and non-mutating) named merge(_:uniquingKeysWith:) and merging(_:uniquingKeysWith:).

3) The group-by method on Sequence will be made into an initializer on Dictionary: init<S: Sequence, E>(grouping elements: S, by: (E) -> Key) where Value == [E], S.Iterator.Element == E

The author will revise the proposal according. Thank you to everyone who participated in the review of what will be some really useful additions to Dictionary!

Ben Cohen
Review Manager

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution-announce/attachments/20170420/90e02e16/attachment-0001.html>

More information about the swift-evolution-announce mailing list