> On Oct 16, 2017, at 1:08 PM, Xiaodi Wu via swift-evolution > <[email protected]> wrote: > > On Mon, Oct 16, 2017 at 13:15 David Sweeris <[email protected] > <mailto:[email protected]>> wrote: > > On Oct 16, 2017, at 09:21, Michael Ilseman <[email protected] > <mailto:[email protected]>> wrote: >> >> Sets are values. If you add, remove, or mutate any elements you have a >> different Set and thus a potentially different ordering of elements. > > From the “value semantics” PoV, yes. But from the “unordered collection of > values” PoV, Sets/Dictionaries, being unordered, are semantically free to > rearrange the in-memory ordering of their elements without user intervention. > > No, they are not semantically free to do so. The semantics of Collection > forbid it, because the iteration order must be multi-pass. As long as the > value is unchanged, the iteration order is unchanged. That is a documented, > public guarantee of the API.
Even if a Set value has a fixed order, a copy of that value may have a *different* order. How many generic algorithm implementations are going to be confused by that? -- Greg Parker [email protected] <mailto:[email protected]> Runtime Wrangler
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
