RangeSet collection

I thought I would point at this old suggestion as a possibility for inclusion into the new Collections package.

Considering the number of times I have needed to roll my own code implementing this kind of functionality in various languages, I am certain I would find it useful in Swift at some point.

@nnnnnnnn's RangeSet implementation currently lives in a public standalone package, called swift-se0270-range-set. (It is currently the sole component of the Standard Library Preview package.)

The idea with that package is to let people use the new implementation in production before we commit to etching it into stone by adding it to the stdlib -- so you're very much encouraged to add the range set package as a dependency! (It even has a stable version number, guaranteeing source stability.)

RangeSet is miles ahead of the Collections package, because it has been extensively discussed on the forums, and we already had multiple rounds of reviews for it on Swift Evolution. SE-0270 has been accepted by the Core Team.

(If RangeSet was introduced today, I think the Collections package would be a great home for it. If it needs to spend more time in preview form, then it may still be worth considering adding it there!)

2 Likes