Skip to content

Add generic overloads for Equatable.== in SetAlgebra types #183

Closed
@lorentey

Description

It is customary for SetAlgebra types to provide flexible overloads for isSubset/isDisjoint/intersection/etc that can take more types than just Self -- elsewhere we usually have an unconstrained generic overload that can take any Sequence plus a handful of concrete overloads for select types for which we can do a more efficient implementation. (So e.g. OrderedSet provides not only isSubset(of other: Self), but also isSubset(of other: Set<Element>) and isSubset(of other: some Sequence<Element>).)

This applies to all such operations except Equatable.== -- why can't I easily check if a Set and an OrderedSet contain exactly the same members?

Now we wouldn't want to add generic overloads to the == operator, but we can and should add a family of isEqual(to:) methods to types conforming to SetAlgebra that provide this flexibility.

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions