>> >> How is the iteration order of an unordered set or dictionary “publicly >> observable”? If either is implemented such that it can asynchronously >> optimize its storage (maybe by rebalancing a tree or merging two >> non-contiguous array segments or something), its iteration order could >> change without changing what values it contains. Seems like consecutive >> calls to “elementsEquals” (or whatever we’re calling it) should return the >> same answer, if we don’t add, remove, or mutate elements. >> > > Sets are values. If you add, remove, or mutate any elements you have a > different Set and thus a potentially different ordering of elements.
An implementation detail. We could make it a class* and AFAICT that wouldn't break any guarantees on Sequence; and the argument applies equally well to any other unordered Sequence, which has no value type or semantics constraint. *: obviously we won't, I don't think anyone is advocating that.
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution