[swift-evolution] Proposal: Add a sequence-based initializer to Dictionary

David Hart david at hartbit.com
Fri Jan 15 02:45:27 CST 2016


It may sound counter-intuitive to have such an initialiser failable for many users. I *think* I would prefer it to silently use the last key.

> On 15 Jan 2016, at 01:31, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> One caveat is that the new initializer doesn't prevent using a sequence with multiple identical keys. In such a case, the last key/value would "win" and exist in the dictionary.
> 
> Another alternative would be to make the initializer failable and have it fail if a key is duplicated.
> 
> -- 
> Brent Royal-Gordon
> Architechies
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list