<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="">Hi Gregg —<div class=""><br class=""></div><div class="">The Dictionary(_:uniquingKeysWith:) initializer was added for this purpose in Swift 4—please see&nbsp;<a href="https://developer.apple.com/documentation/swift/dictionary/2892961-init" class="">https://developer.apple.com/documentation/swift/dictionary/2892961-init</a><br class=""><div><br class=""></div><div>Nate</div><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 8, 2018, at 1:02 PM, Gregg Wonderly 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=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">In some dictionary implementations, key-value pairs are added with an add()&nbsp;method&nbsp;which disallows duplicate keys to be inserted with a runtime exception. &nbsp;Providing an additional method of set() allows for the ability to ignore duplicate keys so that it feels more like dict[key] = value. &nbsp;It might be interesting to provide this as a selectable behavior within an additional constructor's arguments. &nbsp;<div class=""><br class=""></div><div class="">Dictionary(allowDuplicate: true, pairs:&nbsp;<span style="background-color: rgb(255, 255, 255);" class=""><span style="white-space: pre-wrap;" class="">[("z", 1), ("z", 2), ("z", 3), ("z", 4)]) so that the dictionary behavior remains in line with the compile time checks.</span></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><span style="white-space: pre-wrap;" class="">Gregg</span></span></div><div class=""><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>