Skip to content

Identical nodes are not removed by unique #55

@KronosTheLate

Description

@KronosTheLate

Code says more than 1000 words:

julia> my_node1 = XML.Element("wpt")
Node Element <wpt>

julia> my_node2 = XML.Element("wpt")
Node Element <wpt>

julia> my_node1 == my_node2
true

julia> unique([my_node1, my_node2])  # This returns two identical Nodes
2-element Vector{Node}:
 Node Element <wpt>
 Node Element <wpt>

julia> hash(my_node1), hash(my_node2)  # It is caused by different hashes for identical objects
(0xb74eb41702f2670f, 0xcd3b89a9eea9e270)

This feels like a correctness-bug to me. Should we create a custom method for unique and unique! (or only the one that is the basis of the other I guess) that respects equality? If not, it becomes rather cumbersome to remove duplicates from vectors of nodes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions