November 12
dabrahams:
RangeSet
is documented as “a set of ranges of anyComparable
value.” I believe that is a proper description of its non-mutating semantics. That means that the elements of the set are ranges.
RangeSet
is the set of all the values in its constitutive ranges, where the values can be of anyComparable
type — integers, floats, strings, collection indices, etc.
So it’s a set of comparable elements, not a set of ranges I guess the fact that I interpreted it the other way means this proposal needs some editing and clarification! This also explains (along with the fact that I overlooked that part of the proposal) why we're on different pages about constituent empty ranges.
Likewise,
RangeSet
has no notion of containing emptyRange
s, because empty ranges represent no values inT
. Inserting an empty range therefore never has an effect on aRangeSet
.
In that case, IMO it's clear that the insert that takes a range ought to be spelled something like s.insert(allIn: range)
, and other APIs should be similarly reconsidered.
-Dave