From: Jarmo Pertman Date: 2010-07-30T22:00:05+09:00 Subject: Re: .any?{} Behavior Hello! I'd have to agree with John on this one. It is really bizarre that [].any? returns false and [].all? returns true. It is just not what to expect without reading documentation and thinking about every word written in there and trying things out in irb. I love Ruby because most of the time everything just works as you'd expect without reading any documentation at all and this is not the case. It just doesn't make sense that asking Ruby to answer the question "does this empty collection have all elements as 3?" to return true. Read again the question and you'll understand what i mean. Again, if i think about Ruby being a very much like a version of an English language, then this doesn't make sense also. And since i'd expect it to do what i have been expected then i haven't thought about this situation ever also. I'd consider this to be changed in future versions of Ruby, but what am i to decide on such things :) It would make sense if [].all? and [].any? would return false. Always. Jarmo Pertman ----- IT does really matter - http://www.itreallymatters.net On Jul 30, 8:16 am, John Sikora wrote: > John W Higgins wrote: > > I might suggest your better course would be to create a new method > > rather > > than override the existing method. Maybe something like js_any? or > > js_all? > > would be better in that it shows both what it's doing and that it's not > > the > > standard method at the same time. Then you have no issues with any other > > code that depends on the standard methodology in terms of the methods. I > > appreciate the aesthetics are a little lacking but sometimes that a > > small > > price to pay. > > After reading your post and the previous post from David, I agree. > > Thanks, > js > -- > Posted viahttp://www.ruby-forum.com/.