Skip to content

delete! semantics for vector vs. set #3023

@mlubin

Description

@mlubin

There's an issue with the overloaded use of delete! to mean removing both a particular index from a vector and a particular element from a set: vectors partially implement set functions, and some set functions return vectors. See below.

julia> s1 = IntSet(10,12,13);s2 = IntSet(14,15,16);s3 = IntSet();

julia> u = union(union(s1,s2),s3)
IntSet(10, 12, 13, 14, 15, 16)

julia> delete!(u,12)
12

julia> u2 = union(s1,s2,s3)
6-element Any Array:
 10
 12
 13
 14
 15
 16

julia> delete!(u2,12)
ERROR: BoundsError()
 in delete! at array.jl:765

This particular case would be fixed by implementing union(s::IntSet,sets::IntSet...) to return an IntSet, but I think the problem is a bit bigger than this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs decisionA decision on this change is needed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions