From: "R. Kumar" Date: 2010-01-12T23:09:06+09:00 Subject: Re: Is 'rescue' expensive ? I単aki Baz Castillo wrote: > El Martes, 12 de Enero de 2010, R. Kumar escribi坦: >> I単aki Baz Castillo wrote: >> > El Martes, 12 de Enero de 2010, R. Kumar escribi坦: >> > Ruby 1.9 has Array#size, sure. >> >> I looked at http://yardoc.org/docs/ruby-core/Array and it did not show a >> `size` method. >> Perhaps that's been aliased and the doc does not report aliases. Best >> thing is for me to try it in 1.9! > > irb(main):023:0> RUBY_VERSION > "1.9.1" > > irb(main):025:0> RUBY_PATCHLEVEL > 376 > > irb(main):024:0> [].size > 0 > > > :) Yes, i just checked myself. "size" matters :-). If in 99 pc cases, "count" works, then the rescue is only read by the interpreter in the 1% case where it fails. Is that right? (Anyway, for this particular case, i am changing count to size) -- Posted via http://www.ruby-forum.com/.