Actions
Feature #19600
closedMethod `clamp?`
Feature #19600:
Method `clamp?`
Status:
Closed
Assignee:
-
Target version:
-
Description
Currently, we have pairs of non-predicate and predicate methods like String#match and String#match?. Along this line, I propose the following. They are brain-friendly, and make programmers happier by saving them from terminology hell.
- Since by #19588,
Comparable#clamp's behavior is made the same asRange#cover?for range arguments, aliasRange#cover?asRange#clamp?. - Synchronize the specification of
Comparable#between?withComparable#clamp, i.e.,
a. AllowComparable#between?to take a range argument, and
b. AllowComparable#between?to takenilas either or both of its arguments, or as either or both ends of its range argument. - Alias
Comparable#between?asComparable#clamped?
Updated by sawa (Tsuyoshi Sawada) over 2 years ago
- Description updated (diff)
Updated by sawa (Tsuyoshi Sawada) over 2 years ago
- Description updated (diff)
Updated by nobu (Nobuyoshi Nakada) over 2 years ago
Since the method clamp makes a value covered by a range from an uncovered value, clamp? doesn't feel same as cover? or between?, to me.
Extending Comparable#between? sounds nice.
Updated by matz (Yukihiro Matsumoto) over 2 years ago
- Status changed from Open to Closed
This issue includes multiple proposals, and the rationale is only explained 'brain-friendly', which may vary person to person.
Please make sure one issue contains only one proposal, with subjective rationale or real world use-cases.
For this particular case, I am not convinced by any of the proposals.
Matz.
Actions