<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="">A Set has indices because they are useful to use with the type. Regardless of whether Set conforms to Collection, or even Sequence, indices are useful and meaningful for Sets. Even if the entire protocol hierarchy were to be redesigned, Set would provide indices. If Set didn’t implement any protocols at all, Set would still provide indices. Independent of whether Set even provides an Iterator, Set would still provide Indices.<div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 16, 2017, at 10:19 AM, Kevin Nattinger <<a href="mailto:swift@nattinger.net" class="">swift@nattinger.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="">[…]</div>Set conforming to Collection is even worse than just conforming to Sequence as a quote from the documentation shows: "<span class="" style="background-color: rgba(255, 255, 255, 0);">In addition to the operations that collections inherit from the <code class="code-voice" style="box-sizing: inherit;">Sequence</code> protocol, you gain access to methods that depend on accessing an element at a specific position in a collection."</span></div><div class="">Clearly the elements of a Set do not have specific positions.</div><div class=""><br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">That’s not at all clear to me, could you elaborate? My understanding is that elements of Set definitely *do* have a position, and that’s why you can use an index on a set to retrieve the element. The same index on the same set retrieves the same element.</div></div></blockquote><br class=""></div><div class="">A Set only has "indices" because it confirms to a protocol where almost all the requirements are meaningless for an unordered collection. Or at best, for the same reason it has an "order": as a side-effect of the fact that it can be iterated over, you can give indices for each element on a specific iteration; those indices are meaningless for the set itself, and should not be used for anything but a full, order-independent iteration.</div></div></div></blockquote></div><br class=""></div></body></html>