# Assigning a dictionary without re-hashing

**URL:** <https://forums.swift.org/t/assigning-a-dictionary-without-re-hashing/57699>\
**Category:** Using Swift\
**Created:** [May 30, 2022, 3:52pm UTC](https://forums.swift.org/t/assigning-a-dictionary-without-re-hashing/57699 "2022-05-30T15:52:29Z")\
**Posts on this page:** 1\
**Showing post:** 28

<div class="post-metadata">

**Author:** ![lorentey](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lorentey/32/1299_2.png) [@lorentey](https://forums.swift.org/u/lorentey)\
**Post date:** [June 27, 2022, 6:16pm UTC](https://forums.swift.org/t/assigning-a-dictionary-without-re-hashing/57699/28 "2022-06-27T18:16:48Z")

</div>

> [@xwu](#):
>
> Can we formalize this guarantee?

Absolutely. This is a (semantic) API change, so I expect it'll require going through Swift Evolution. I've been collecting other ill-defined aspects of the stdlib -- perhaps we have a large enough batch of these now to be worth the expense of a small proposal.

> [@Regression in Set with Swift 5.5](https://forums.swift.org/t/regression-in-set-with-swift-5-5/53130/19):
>
> That would be an excellent idea! Are you volunteering to write it up? So right now we have: Sequence.sorted(), .sorted(by:), MutableCollection.sort(), .sort(by:) should document that the sort algorithm is stable. (Starting from Swift x.y) Set.union(\_:), Set.intersection(\_:), and Set.formIntersection(\_:) (all overloads) should document that members of the result that appear in both inputs are taken from self. (Interestingly, formUnion already has this guarantee.) (Starting from Swift 5.6) A…

(Edit: [unifying and documenting the expected behavior of `base` properties on mutable slices](https://forums.swift.org/t/how-to-find-range-in-new-string-after-replacingcharacters-in-range-with-c/58367/17) could also be part of this, although that one also requires actual behavioral changes in some obscure corners of the stdlib.)

---

_[View the full topic](https://forums.swift.org/t/assigning-a-dictionary-without-re-hashing/57699)._
