My initial reactions were a strong "-1", but I have since been forced to change my mind.
At first glance (and I would say that the pitch could use some refinement in this regard), there's not much difference between the proposed RangeSet<T>
and a Set<T>
that has a backing storage of discontiguous ranges. For all the simple cases (and these are the only cases described in the pitch), this is accurate: A RangeSet<Int>
is functionally identical to a Set<Int>
.
However, after further examination, there is one major flaw with using a Set<T>
instead of a RangeSet<T>
, and that is with values that are not countable. A trivial example of this is Double
; you cannot effectively count the number of double values between (for example) 1.0
and 1.1
. Since you cannot count them, you cannot form a Set<T>
of them, because Set
has the requirement of providing a count.
Thus, after a lot of thought, I am reluctantly in favor of this proposal.