# On the elementsEqual problem, or “\[Pitch\] Set and Dictionary should not be Sequences”

**URL:** <https://forums.swift.org/t/on-the-elementsequal-problem-or-pitch-set-and-dictionary-should-not-be-sequences/12227>\
**Category:** Pitches\
**Created:** [April 28, 2018, 6:41pm UTC](https://forums.swift.org/t/on-the-elementsequal-problem-or-pitch-set-and-dictionary-should-not-be-sequences/12227 "2018-04-28T18:41:49Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![Jon\_Hull](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_hull/32/678_2.png) [@Jon\_Hull](https://forums.swift.org/u/Jon_Hull)\
**Post date:** [April 29, 2018, 10:32am UTC](https://forums.swift.org/t/on-the-elementsequal-problem-or-pitch-set-and-dictionary-should-not-be-sequences/12227/25 "2018-04-29T10:32:45Z")

</div>

I think my [suggestion](https://forums.swift.org/t/pitch-make-collection-super-convenient-and-retire-sequence/12103/15) from the remove Sequence thread is a possible solution here.

Basically, we need to rethink the hierarchy underlying Collection. I think I agree with removing sequence, but at the same time we also need protocols which deal with the aspects of collection of a container and collection as an ordering separately. If we do this, I think with a bit of work, we can unify a bunch of different protocols which are currently separate into a single hierarchy.

Let's think through our options carefully and make a single set of changes!

> [@gwendal.roue](#):
>
> What I really like about the current conformance of Set and Dictionary to Collection/Sequence is the ability to write a method that accepts a container-whose-ordering-does-not-matter as an argument, which the user of that method can feed with sets, or arrays, or any other collection, without even thinking about it. The old way of doing it, feeding [set allObjects] instead of the set itself, looks so “pre-POP” in comparison.

I really think we need a protocol with this concept of a container where the order of iteration doesn't matter (or isn't defined). Sequence definitely wasn't that (nor would the name imply it to be), but this protocol would be the proper place for several of the methods placed on Sequence (e.g. `contains(where:)`, map, etc...).

---

_[View the full topic](https://forums.swift.org/t/on-the-elementsequal-problem-or-pitch-set-and-dictionary-should-not-be-sequences/12227)._
