You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is to track adding support for iterators (added to Go 1.23 on 2024/08/14). Currently, a rangeset can return a slice of elements (method Values()) and a slice of ranges (method Spans()). We'd always intended to add some sort of iterators as working with whole slices is cumbersome and inefficient.
Callers of the existing methods would often be much better served by iterators instead of slices. For example, you don't need to get the whole slice before starting to use it, and can terminate at any time. This is particularly relevant to rangesets as they can be easily be used to represent a huge number of elements.
The proposal is to supplement Values() method with two methods called All() and Backwards() which allow iteration over all the elements in the normal and reverse direction. Similarly, we'll add SpansValues() and SpansBackwards().
The text was updated successfully, but these errors were encountered:
This issue is to track adding support for iterators (added to Go 1.23 on 2024/08/14). Currently, a
rangeset
can return a slice of elements (methodValues()
) and a slice of ranges (methodSpans()
). We'd always intended to add some sort of iterators as working with whole slices is cumbersome and inefficient.Callers of the existing methods would often be much better served by iterators instead of slices. For example, you don't need to get the whole slice before starting to use it, and can terminate at any time. This is particularly relevant to rangesets as they can be easily be used to represent a huge number of elements.
The proposal is to supplement
Values()
method with two methods calledAll()
andBackwards()
which allow iteration over all the elements in the normal and reverse direction. Similarly, we'll addSpansValues()
andSpansBackwards()
.The text was updated successfully, but these errors were encountered: