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
Thank you for this excellent overview of planned additions and tradeoffs considered!
I want to comment on the following:
Common supertype of ClosedRange and OpenEndRange
...
Introducing a more dedicated common supertype of the ClosedRange and OpenEndRange could help in this situation, however, it's unclear what useful operations such supertype would provide.
I'm the library author of kotlinx.interval, which approaches ranges using a common generic base type (including the possibility of a separate type parameter for range 'sizes'). To help assess whether or not such a base type may be useful, I will soon continue porting some of the existing C# implementation I did to Kotlin, and add example use cases.
In short, I remember using them in a generic binary sort algorithm, and operations on range collections. I.e., given a collection of time intervals, does a specified timestamp fall within any of the ranges, or what's the Duration covered by a set of Instant intervals? But, likely those could have been simple collections of closed ranges only. I don't recall fully whether mixing half-open and closed ranges was ever a true requirement for these use cases.
This issue is for discussion of the proposal to introduce
rangeUntil
(..<
) operator in Kotlin and the corresponding types for open-ended ranges.Proposal PR #315
The text was updated successfully, but these errors were encountered: