Add protocols for unordered collections (and 'sequences')

This is not the first time that this suggestion has been put forward. Now that the archives are easily searchable, I'd recommend a review and summarization of previous conversation first so that we don't expend a considerable amount of time rehashing the same topic.

If I recall correctly, the bottom line is that Swift's protocol hierarchies attempt to make useful algorithms possible, and in the course of doing so, actively tries to balance the desire for perfectly granular modeling against the difficulties of having too many protocols. You'll see in previous conversations that the imperfect fit of ordering-sensitive methods for unordered collections has not escaped the attention of API designers, but that the present design is seen as reflecting the best balance of trade-offs.

My suggestion to people who want to tackle this area, therefore, is to be clear-minded about whether any proposed changes are sensitive to the delicate balancing task and to share your thinking on the detailed pros and cons rather than only enumerating a list of changes.

3 Likes