名前重要 (Range編)
訳した。けど、やっぱ難しいわ、英語。業務よりじゃなくて数学よりな洋書を読まないとついてけないな。
- set
- 集合
- discrete
- 離散的な
- magnitude relation
- 大小関係
他にも "contain?" じゃないメソッドを contain という単語を使って説明していいものかとか色々ある。
Two new method names of Range.
Matz wants a good idea about two new method names on his blog("2005-12-10":http://www.rubyist.net/~matz/20051210.html).
One is the method to check whether a Range object contains an element or not, by comparison operators. Existing "include?" and "member?" means containing discrete set - except Number - from 1.9.
This method return true if "beg <= x <= end", like this:
(beg..end).foo?(x)Matz takes a fancy for "cover?", but he would change his mind if you suggested him a better one. Matz likes a short name for convenient method.
Another method is one to check whether an object is conteined in the "succ" array between "beg" and "end" or not.
x.bar?(beg, end)This method would return true if "x" were contained, and return false if "x" were not contained or "succ" can't reach from "beg" to "end".
It will be used in other method such as "include?". So, he would't care if it had a long name.
This method and "between?" is alike, but "Comparable#between?" compares by magnitude relation. The new method is discrete.
Please see the thread "[ruby-talk:167182]":http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/167182?167051-169742
bar は bar? だよな?きっと。勝手に変えた。