If val1 > val2, the app will crash with error "Can't form Range with upperBound < lowerBound"
To prevent this, we are forced to check that val1 < val2 every time, which is annoying.
To prevent this, we can make one more clamped(to:) overload:
@John_McCall As mentioned on Github I want to continue the conversation here on this thread before opening a new PR.
I still think this would be a great idea and very useful and there is discussion among community members but not too much back and forth with members of the core team.
Maybe things are a bit more stable now so we can go over this proposal again?
Thoughts on spelling this .bounded(within: some RangeExpression<Self>)?
(Where some RangeExpression<Self> are overloads for every Range type that would make sense to bound a value by, e.g. ClosedRange, PartialRangeFrom, & PartialRangeThrough)