Skip to content

Hashable documentation should be more clear about relationship with Equatable #66282

Open
@natecook1000

Description

@natecook1000

The Hashable documentation should be more clear about the exact relationship of the Hashable and Equatable protocols. Specifically, the docs should make the expectation that all properties that are included in the == implementation are also included in hash(into:) and vice versa. It would be great if the docs could also discuss what happens if something like a struct property is left out of the Hashable/Equatable conformance implementations.

For the Set type, the docs should describe the requirement for the elements. That is, Hashable conformance is required and a type's Equatable is used to determine uniqueness within the set.

Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    EquatableArea → standard library: The `Equatable` protocolHashableArea → standard library: The `Hashable` protocolbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.documentationstandard libraryArea: Standard library umbrella

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions