<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 16, 2017, at 1:08 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><div class=""><div class=""><br class=""><div class="gmail_quote"><div dir="auto" class=""><blockquote type="cite" class=""></blockquote></div></div></div></div></blockquote><div class=""><div class=""><div class="gmail_quote"><div dir="auto" class=""><blockquote type="cite" class="">On Mon, Oct 16, 2017 at 13:15 David Sweeris <<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>> wrote:<br class=""></blockquote></div></div></div></div><blockquote type="cite" class=""><div class=""><div class=""><div class="gmail_quote"><div dir="auto" class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><br class=""><div class="">On Oct 16, 2017, at 09:21, Michael Ilseman <<a href="mailto:milseman@apple.com" target="_blank" class="">milseman@apple.com</a>> wrote:<br class=""></div><blockquote type="cite" class=""><div class=""><div class=""><br class=""></div><div class="">Sets are values. If you add, remove, or mutate any elements you have a different Set and thus a potentially different ordering of elements.</div></div></blockquote><br class=""></div><div dir="auto" class=""><div class="">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 <i class="">without</i> user intervention.</div></div></blockquote><div dir="auto" class=""><br class=""></div><div dir="auto" class="">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.</div></div></div></div></blockquote><br class=""></div><div><div>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?</div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="">-- </div><div class="">Greg Parker <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a> Runtime Wrangler</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>