From: Yusuke ENDOH Date: 2011-04-13T23:55:43+09:00 Subject: [ruby-core:35744] Re: [Ruby 1.9 - Feature #4574] Numeric#within Hello, 2011/4/13 : >> I like Numeric#limit and/or Numeric#clip. �I think "limit" is more mathematical, and "clip" is more easy to understand its functionality from its name. �So I believe it is acceptable that the both names are provided. > > I agree, I find #limit and #clip more explicit than the others of the list (and #clamp) ... Thank you, but I'm going to like clamp :-) "clamp" seems not only the term of computer graphics, but also the term of mathematics. Kenta found the following article: http://en.wikipedia.org/wiki/Saturation_arithmetic > If the result of an operation is greater than the maximum it is set ("clamped") to the maximum, while if it is below the minimum it is clamped to the minimum. > Yusuke Endoh wrote: >> Some Japanese committers agree with this idea > > It's nice to also see this discussion on ruby-core. Note that I have not gotten matz's approval yet :-) >> I can accept Range method, but why? >> I think that the subject of this feature is the limited Numeric. I forgot to tell another issue of Range method. It is difficult to define the behavior of "(2...5).bound(6)". My previous patch lets the code raise an ArgumentError, but I'm not sure if it is right. -- Yusuke Endoh